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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.