disabled elements are not submitted with the form

as per the html spec (below)

http://www.w3.org/TR/html4/interact/forms.html#h-17.12

---begin---

17.12.1 Disabled controls
Attribute definitions

disabled [CI]
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.

<INPUT disabled name="fred" value="stone">

Note. The only way to modify dynamically the value of the disabled attribute
is through a script.

---end---

> -----Original Message-----
> From: Juan Alvarado (Struts List) [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 3:42 PM
> To: Struts
> Subject: Has anyone seen this issue
>
>
> Hello Everyone:
>
> I've come across an interesting issue that I'd like to share with everyone
> with the hopes that someone might be able to provide an explanation or
> solution.
>
> I have a form with a bunch of text fields. One of these fields I want to
> have disabled (disabled="true"). So using the struts tag library
> I have the
> following:
>
> <html:text property="role" size="16" maxlength="16" disabled="true" />
>
> When I first load this form, everything is prepopulated as it should be in
> the form. I submit the form leaving some fields blank so that I can ensure
> my validation works. The validation works fine as the I am redirected back
> to the form with the appropriate error messages. However, the text field
> mentioned above (role), is no longer prepopulated. Everything
> else is except
> that text field. I took out the disabled="true" and submitted the
> form again
> and the next time around the text field WAS prepopulated. I put back
> disabled="true" and the field WAS NOT prepopulated. So I realized that
> disabled="true" is causing a glitch somewhere.
>
> After scratching my head for a while I decided to put the Visual Age
> Debugger to use to see if I could see what was going on. This is what I
> found out:
>
> When I go to the form the very first time, the setRole(String role) method
> in my form bean is getting called and therefore that property
> gets set. But
> when I submit the form and I have disabled="true" in the text field, the
> setRole(String role) method never gets called therefore the property never
> gets set. A very interesting thing is that I looked inside the request
> object with the VAJ debugger and the role parameter is not there when I
> submit my form to my validation action with disabled="true" in the text
> field. When I took out the disabled="true" the role parameter was
> inside the
> request. So the problem boils down to the fact that the parameter is not
> included in the request object when using disabled="true" and
> therefore does
> not get set.
>
> If anyone has seen this problem and has a fix or suggestion, please let me
> know.
>
> Thanks in advance
>
> **********************************************
> Juan Alvarado
> Internet Developer -- Manduca Management
> (786)552-0504
> [EMAIL PROTECTED]
> AOL Instant Messenger: [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to