Eiolon Posted October 31, 2007 Share Posted October 31, 2007 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 More sharing options...
mainewoods Posted October 31, 2007 Share Posted October 31, 2007 --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 Link to comment https://forums.phpfreaks.com/topic/75564-solved-semi-disabling-text-field/#findComment-382345 Share on other sites More sharing options...
Eiolon Posted October 31, 2007 Author Share Posted October 31, 2007 Thanks, works like a charm Link to comment https://forums.phpfreaks.com/topic/75564-solved-semi-disabling-text-field/#findComment-382393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.