0

I am using magento2.1 If I am using class="validate-one-required-by-name and validate-select" it's not working.

<div class="control" style="margin:10px"> 
<select id="myselect" name="mySelect" class="validate-one-required-by-name" title="<?php /* @escapeNotVerified */ echo __('Requested Type') ?>">
<option value="choose"><?php /* @escapeNotVerified */ echo __('Please Select Options.') ?></option>
<option value="1">Test</option>
<option value="2">Test two</option>
<option value="3">Test Three</option>
<option value="4">Test Four</option>
</select>
</div>

Thank You

  • Have you got solution? – Chirag Patel Sep 26 '18 at 8:36
1

try with class="required-entry".

0

You have to add null or empty value to select for validation work. When you add like this

<option value="choose"><?php /* @escapeNotVerified */ echo __('Please Select Options.') ?></option> it will not consider blank value so you should add like this

<option value=""><?php /* @escapeNotVerified */ echo __('Please Select Options.') ?></option>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.