Submit disabled form elements...

S

SirG

Is there a way to submit a disabled text box?

I'm wanting to use a disabled text box to submit use picked date
information that is selected using a date picker script, but I do not
want the users to have the ability to modify the date outside of the
script.

Is this possible?
 
J

Jukka K. Korpela

Scripsit SirG:
Is there a way to submit a disabled text box?

By definition, disabled means it won't be included in the form data, i.e.
won't be submitted. So why do make it disabled and then ask how to get it
submitted?

(There are ways to have it included it in form data via JavaScript, but they
more or less mean that it is taken away from the disabled state.)
I'm wanting to use a disabled text box to submit use picked date
information that is selected using a date picker script, but I do not
want the users to have the ability to modify the date outside of the
script.

I wonder what you are really doing. You cannot prevent users from modifying
the data, or submitting whatever data they want; you can just try to cope
with it and to discard malformed data.

As usual, a URL would...
 
S

SirG

I wonder what you are really doing.

I'm building an Intranet helpdesk site and the page I am currently
working on has a date picker control that populates a text box with
the date selected by the user. They need to be able to see the date
they pick but not modify it unless they use the script to change/
modify/clear the selected date.

Due to the fact that they need to be able to see the date chosen a
hidden text box won't work for this situation, but thanks for the
idea.

The reason I do not want the users to be able to modify the date
chosen is because I need this information is a specific format.
Unfortunatly, I'm not good with java or java frameworks although I am
looking into them for input validation.


Does that help clarify what I'm doing? Any suggestions for a work
around?

As usual, a URL would...

Ahh yes, I would love to submit a url however, the only thing I ever
work on is the intranet... which means no outside facing pages.
*shrug*
 
S

SirG

http://www.w3.org/TR/html401/interact/forms.html#adef-disabled

Thanks for the link. After reading through that I've decided to use
the readonly option instead of disabled as that does what I'm looking
for.
* Read-only elements receive focus but cannot be modified by the
user.
* Read-only elements are included in tabbing navigation.
* Read-only elements may be successful.


Thanks for the help!

Steve
 
J

Jonathan N. Little

SirG said:
I'm building an Intranet helpdesk site and the page I am currently
working on has a date picker control that populates a text box with
the date selected by the user. They need to be able to see the date
they pick but not modify it unless they use the script to change/
modify/clear the selected date.

Display the date as plain text but not in a form element for the user
and put the date in a hidden field for transmission, OR instead of the
hidden field, have the receiving script assign the date and time...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top