Hi all.

I have two date input fields. Is there any way to restrict date input from only date picker (users are not allowed to input date through keyboard). The reason I want it this way is to prevent users from entering invalid dates.

Any help provided is greatly appreciated. Thanks in advance.

Recommended Answers

All 4 Replies

assuming that u already have a datepicker which sets the selected date value in a text field, u can make ur textbox as readonly... just add the "readonly" attribute in ur input field

Hi all.

I have two date input fields. Is there any way to restrict date input from only date picker (users are not allowed to input date through keyboard). The reason I want it this way is to prevent users from entering invalid dates.

Any help provided is greatly appreciated. Thanks in advance.

Thanks you very much venkat0904. I've solved it. Have a nice day ^_^

Btw, for any others that may facing same problem, here's how:

<FORM>
<INPUT TYPE="TEXT" VALUE="if($dateFrom !=NUll){echo $dateFrom}" READONLY>
</FORM>

anytime... just remember to visit forum often n help others in need..
cheers !!!

Thanks you very much venkat0904. I've solved it. Have a nice day ^_^

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.