I had created the date of birth field with a drop down list after selecting the year drop down the years are getting repeated

I am attaching my code and image file.

Can u please suggest me.


2 Answers 2


Regardless how you populate your select options, just need to add class validate-select to any <select> element you want to validate.

validate-select requires user to select an option.

In your case, change validate-entry to validate-select, then it works.

  • I changed the code as you suggested but not working.It is not asking is required when i click on the generate button it is directly going to another page with null data.Please suggest me Commented Jul 7, 2015 at 6:45
  • while developing, please turn off any cache solution, even pagespeed. I see your form code var dataForm = new VarienForm('form-custom-search', true); doesn't excute at all. Commented Jul 7, 2015 at 7:09
  • Yes,I changed now it works fine but when i select year 2005 or any number it is showing repeated years after selecting.I am attaching the image.Please suggest me. Commented Jul 7, 2015 at 7:46
  • Remove this code and all js code following it kcyear.addEventListener("change", validate_date); also remove onchange=call() in <select>. Commented Jul 7, 2015 at 8:26
  • If i remove those it will not load day and year then how can i overcome this issue Commented Jul 7, 2015 at 8:30

You only added class="required" to the <label>. This way you get a red * next to the label, nothing more, nothing less. Look at the <select> element for gender to see how it is done.

  • I added the class to select element for date of birth field also but it getting same error for me.When i click on the generate button it is not asking is required directly it is going to new page without filling the form. Commented Jul 7, 2015 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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