hi i have used datepicker for picking date and i need to validate for empty value .i should not allow the user to go to next page without selecting any dates how to do that ..

Recommended Answers

All 10 Replies

i have used jquery datepicker so im getting error

i have used jquery datepicker so im getting error

What error message with what code?

    $( "#date" ).datepicker({
minDate: 0, 
maxDate: " +10D" ,
dateFormat:'yy-mm-dd'

    });
  });

  <b>Date:</b><input type="text" name="date" id="date"  readonly>
   this is my code .the calender displays to pick the date .
   the problem is that it also accepts empty value plz help me to solve. 

Set a default date, or use Javascript to check for an empty value on submit. I don't think that option is embedded in the datepicker.

i want to display the error message in a alert box or is it possible in using html "require"

Both are possible. Here is some nice info on required.

i have used required but its not working .. my input type is text and it is set as readonly

<b>Date:</b><input type="text" name="date" id="date" required readonly>

readonly fields ignore required

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.