List Info

Thread: disable, readonly bug




disable, readonly bug
country flaguser name
United States
2007-08-30 12:20:33



I noticed that while using disable or readonly attributes of
<t:inputText>
or <h:inputText>, when the disable attribute changes
from true to false and
then value of the input text field is changed, the change
does not take
effect. When the disable attribute switches to true again,
the old value is
redisplayed and not the changed value.

The setter methods of the property bound to the inputText 
are not being
called.

This case arises only when the disabled attribute = true at
page load time.

I saw an entire application using value change listeners to
call the field
setter methods manually.  I think this totally ruins the fun
in using JSF.
Has anybody else noticed this behaviour? and does anyone
have a solution
for this?

Thanks

Gargi
850-414-5852
CONFIDENTIALITY NOTICE:  This message and any attachments
are for the sole
use of the intended recipient(s) and may contain
confidential and
privileged information that is exempt from public
disclosure.  Any
unauthorized review, use, disclosure, or distribution is
prohibited.  If
you have received this message in error please contact the
sender (by phone
or reply electronic mail) and then destroy all copies of the
original
message.


Re: disable, readonly bug
user name
2007-08-30 12:41:34
html disabled attribute means don't send the input field
value back to
the server when the form is submitted.  If you want to be
able to
change the field value, don't set the field disabled.  (or
at least
use javascript to un-disable it before you submit the form)

On 8/30/07, Gargi Iyer <Gargi_Iyerdcf.state.fl.us> wrote:
>
>
>
>
> I noticed that while using disable or readonly
attributes of <t:inputText>
> or <h:inputText>, when the disable attribute
changes from true to false and
> then value of the input text field is changed, the
change does not take
> effect. When the disable attribute switches to true
again, the old value is
> redisplayed and not the changed value.
>
> The setter methods of the property bound to the
inputText  are not being
> called.
>
> This case arises only when the disabled attribute =
true at page load time.
>
> I saw an entire application using value change
listeners to call the field
> setter methods manually.  I think this totally ruins
the fun in using JSF.
> Has anybody else noticed this behaviour? and does
anyone have a solution
> for this?
>
> Thanks
>
> Gargi
> 850-414-5852
> CONFIDENTIALITY NOTICE:  This message and any
attachments are for the sole
> use of the intended recipient(s) and may contain
confidential and
> privileged information that is exempt from public
disclosure.  Any
> unauthorized review, use, disclosure, or distribution
is prohibited.  If
> you have received this message in error please contact
the sender (by phone
> or reply electronic mail) and then destroy all copies
of the original
> message.
>
>

Re: disable, readonly bug
country flaguser name
Belgium
2007-08-30 12:44:01
Hi,

Your problem, i think is that you submit a value to the
field and , in 
same resquest, try to change the disabled attribute of
field.

For a specific field's value to go from submit to backing
bean, the 
disabled attribute msut be false at all steps of lifecycle:

apply-request value (to store the submitted value)
validation (all form is being validated)
update model (disabled field do not update model)

At each step, the EL-expression of your "disabled"
field is evaluated.

i think (difficult to say without sample of your jsf form)
that your 
bean property handling the disabled state changes at the
wrong time. 
example, you enter a value in non-disabled field, un check
the "activate 
box" and submit. The box has been configured, probably,
with 
immediate=true, this mean the field goes to disabled state
before it's 
apply-request value gets called.

Another possibility could be you store this state (disabled)
in a 
request scoped bean which default to true. Then, until you
reach update 
model, the field is considered disabled.

Those are just supposition, need jsf sample to confirm.



Gargi Iyer a écrit :
>
>
> I noticed that while using disable or readonly
attributes of <t:inputText>
> or <h:inputText>, when the disable attribute
changes from true to false and
> then value of the input text field is changed, the
change does not take
> effect. When the disable attribute switches to true
again, the old value is
> redisplayed and not the changed value.
>
> The setter methods of the property bound to the
inputText  are not being
> called.
>
> This case arises only when the disabled attribute =
true at page load time.
>
> I saw an entire application using value change
listeners to call the field
> setter methods manually.  I think this totally ruins
the fun in using JSF.
> Has anybody else noticed this behaviour? and does
anyone have a solution
> for this?
>
> Thanks
>
> Gargi
> 850-414-5852
> CONFIDENTIALITY NOTICE:  This message and any
attachments are for the sole
> use of the intended recipient(s) and may contain
confidential and
> privileged information that is exempt from public
disclosure.  Any
> unauthorized review, use, disclosure, or distribution
is prohibited.  If
> you have received this message in error please contact
the sender (by phone
> or reply electronic mail) and then destroy all copies
of the original
> message.
>   

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )