• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disabled textarea returns FALSE

#1
[eluser]NateL[/eluser]
I have a textarea that has some text in it when the page loads. By default, I have it set to Disabled. When I submit the form, that textarea then posts empty (false).

How can I get around this?

I thought disabling a textarea was just a way to make sure the contents weren't altered...but I'm not quite sure why the contents are being completely removed on POST.

#2
[eluser]JHackamack[/eluser]
When set for a form control, this boolean attribute disables the control for user input.
When set, the disabled attribute has the following effects on an element:

Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successful.
The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

This attribute is inherited but local declarations override the inherited value.

How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc.

In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

per:
http://www.w3.org/TR/html401/interact/fo...l#disabled

#3
[eluser]JHackamack[/eluser]
One solution you could do is also set a hidden variable that has the text you wish to submit so the user can't edit it and they can't see it. or if you have it stored in a database or file, just retrieve it again on post.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.