Jump to content

[SOLVED] Semi-disabling text field


Eiolon

Recommended Posts

I currently use a date/time chooser that was made in javascript.  The user clicks on the picture of a calendar and selects the date and time.  It then puts the data into the text field of the form.  My question, is there a way to disable the text field so the user HAS to use the date/time chooser to enter the data into the field?  It's very important that the datetime format is kept so I don't want them entering it in their own format.  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/75564-solved-semi-disabling-text-field/
Share on other sites

--change the field that displays the date/time to READONLY in the html, if it doesn't have it, add an 'id=' to that field also

 

find the place in the javascript where the date/time is moved to that field. add a line before it and a line after it:

document.getElementById('datetimefieldID').readOnly = false; //modifiable now
//the statement that assigns the date/time to the field is here
document.getElementById('datetimefieldID').readOnly = true; //protected against the user again

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.