You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Russell Brown <Ru...@ioko.com> on 2008/09/30 15:38:20 UTC

T5: t:select how to disable and re-enable

Hi,
I am using a T5 select component. When the form renders I wish the select to be disabled so I use disabled="true" parameter. However, some javascript causes the field to become enabled. If this happens however the value selected does not get sent into the property of the component. I am assuming this is thanks to the "feature" decribed here http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html thussly : 

"If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a disabled field ignores any value in the request when the form is submitted. "

So how to set the select value to disabled initially but not make it stay that way for ever?

Thanks in advance for your ideas, I have resorted to adding a little javascript that sets it so on load but that is a bit of hack for some fairly simple functionality.

Any reason WHY "Further, a disabled field ignores any value in the request when the form is submitted." this seems to offer zero advantage and loads of problems

Cheers

Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: t:select how to disable and re-enable

Posted by Russell Brown <Ru...@ioko.com>.
 

>Maybe it's possible that you disable your select only clientside?
>If you do so there won't be any problems if you later on enable it again.
.
>Andy

Thanks Andy: like I said 
>> Thanks in advance for your ideas, I have resorted to adding a little javascript that sets it so on load but that is a bit of hack for some fairly simple functionality.

Seems like the only way. Boo. So I have to use the RenderSupport and get the client Id using the tapestry tricks and inject the component and write a fair bit of code just to side step a pretty bizarre and unexplained feature. Sure, it is possible and it works. But the question still stands....why?

Russell

Russell Brown schrieb:
> Hi,
> I am using a T5 select component. When the form renders I wish the select to be disabled so I use disabled="true" parameter. However, some javascript causes the field to become enabled. If this happens however the value selected does not get sent into the property of the component. I am assuming this is thanks to the "feature" decribed here http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html thussly : 
> 
> "If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a disabled field ignores any value in the request when the form is submitted. "
> 
> So how to set the select value to disabled initially but not make it stay that way for ever?
> 
> Thanks in advance for your ideas, I have resorted to adding a little javascript that sets it so on load but that is a bit of hack for some fairly simple functionality.
> 
> Any reason WHY "Further, a disabled field ignores any value in the request when the form is submitted." this seems to offer zero advantage and loads of problems
> 
> Cheers
> 
> Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org




RE: T5: t:select how to disable and re-enable

Posted by Ulrich Stärk <ul...@spielviel.de>.
Have a look at the FormFragment component and the TriggerFragment mixin
for the Radio and Checkbox components. This is basically what you want. It
just hides the fragment of the form completely from the user instead of
disabling it.

Uli

Am Di, 30.09.2008, 16:27, schrieb Russell Brown:
>
> Thanks guys,
> Like I said in the initial post: I am doing this on the client side,
> because I have to.
>
> Doing it on the clientside involves jumping through some hoops. Namely,
> inject the component to get its id and then add some javascript to the
> page using RenderSupport. No problem. It iss done... but I am just
> wondering aloud on the list why I need to jump through the hoops. Why
> tapestry 5 has this feature that costs me a lot to circumvent and benefits
> me very little? I'd just like to know in what cases there is a benefit to
> this behavior so that I don't feel like I am being made to suffer (just
> like I used to in struts)
>
> Cheers
> Russell
>
> -----Original Message-----
> From: Kristian Marinkovic [mailto:kristian.marinkovic@porsche.co.at]
> Sent: Tue 9/30/2008 2:55 PM
> To: Tapestry users
> Subject: Re: T5: t:select how to disable and re-enable
>
> it is not enough to enable the select box only on the client site.
> because if you render a select component with disabled="true"
> tapestry wont even "register" the necessary event handler to
> process the submission.
>
> in tapestry 5 words: no ProcessSubmission component
> event will be serialized into the form thus no values will be
> processed. :)  (see Select->AbstractField component source code)
>
> i see two possibilities: as mentiond by andy do everything on the
> client side or do a ajax request (zone) updatind the select component
> with disabled="false".
>
> g,
> kris
>
>
>
>
>
> Andy Pahne <ap...@net22.de>
> 30.09.2008 15:45
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: t:select how to disable and re-enable
>
>
>
>
>
>
>
>
> Maybe it's possible that you disable your select only clientside?
> If you do so there won't be any problems if you later on enable it again.
>
> Andy
>
>
> Russell Brown schrieb:
>> Hi,
>> I am using a T5 select component. When the form renders I wish the
> select to be disabled so I use disabled="true" parameter. However, some
> javascript causes the field to become enabled. If this happens however the
> value selected does not get sent into the property of the component. I am
> assuming this is thanks to the "feature" decribed here
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html
> thussly :
>>
>> "If true, then the field will render out with a disabled attribute (to
> turn off client-side behavior). Further, a disabled field ignores any
> value in the request when the form is submitted. "
>>
>> So how to set the select value to disabled initially but not make it
> stay that way for ever?
>>
>> Thanks in advance for your ideas, I have resorted to adding a little
> javascript that sets it so on load but that is a bit of hack for some
> fairly simple functionality.
>>
>> Any reason WHY "Further, a disabled field ignores any value in the
> request when the form is submitted." this seems to offer zero advantage
> and loads of problems
>>
>> Cheers
>>
>> Russell
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: t:select how to disable and re-enable

Posted by Russell Brown <Ru...@ioko.com>.
Thanks guys,
Like I said in the initial post: I am doing this on the client side, because I have to.

Doing it on the clientside involves jumping through some hoops. Namely, inject the component to get its id and then add some javascript to the page using RenderSupport. No problem. It iss done... but I am just wondering aloud on the list why I need to jump through the hoops. Why tapestry 5 has this feature that costs me a lot to circumvent and benefits me very little? I'd just like to know in what cases there is a benefit to this behavior so that I don't feel like I am being made to suffer (just like I used to in struts)

Cheers
Russell

-----Original Message-----
From: Kristian Marinkovic [mailto:kristian.marinkovic@porsche.co.at]
Sent: Tue 9/30/2008 2:55 PM
To: Tapestry users
Subject: Re: T5: t:select how to disable and re-enable
 
it is not enough to enable the select box only on the client site.
because if you render a select component with disabled="true"
tapestry wont even "register" the necessary event handler to 
process the submission.

in tapestry 5 words: no ProcessSubmission component 
event will be serialized into the form thus no values will be 
processed. :)  (see Select->AbstractField component source code)

i see two possibilities: as mentiond by andy do everything on the
client side or do a ajax request (zone) updatind the select component
with disabled="false".

g,
kris





Andy Pahne <ap...@net22.de> 
30.09.2008 15:45
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: t:select how to disable and re-enable








Maybe it's possible that you disable your select only clientside?
If you do so there won't be any problems if you later on enable it again.

Andy


Russell Brown schrieb:
> Hi,
> I am using a T5 select component. When the form renders I wish the 
select to be disabled so I use disabled="true" parameter. However, some 
javascript causes the field to become enabled. If this happens however the 
value selected does not get sent into the property of the component. I am 
assuming this is thanks to the "feature" decribed here 
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html 
thussly : 
> 
> "If true, then the field will render out with a disabled attribute (to 
turn off client-side behavior). Further, a disabled field ignores any 
value in the request when the form is submitted. "
> 
> So how to set the select value to disabled initially but not make it 
stay that way for ever?
> 
> Thanks in advance for your ideas, I have resorted to adding a little 
javascript that sets it so on load but that is a bit of hack for some 
fairly simple functionality.
> 
> Any reason WHY "Further, a disabled field ignores any value in the 
request when the form is submitted." this seems to offer zero advantage 
and loads of problems
> 
> Cheers
> 
> Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org





Re: T5: t:select how to disable and re-enable

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
it is not enough to enable the select box only on the client site.
because if you render a select component with disabled="true"
tapestry wont even "register" the necessary event handler to 
process the submission.

in tapestry 5 words: no ProcessSubmission component 
event will be serialized into the form thus no values will be 
processed. :)  (see Select->AbstractField component source code)

i see two possibilities: as mentiond by andy do everything on the
client side or do a ajax request (zone) updatind the select component
with disabled="false".

g,
kris





Andy Pahne <ap...@net22.de> 
30.09.2008 15:45
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: t:select how to disable and re-enable








Maybe it's possible that you disable your select only clientside?
If you do so there won't be any problems if you later on enable it again.

Andy


Russell Brown schrieb:
> Hi,
> I am using a T5 select component. When the form renders I wish the 
select to be disabled so I use disabled="true" parameter. However, some 
javascript causes the field to become enabled. If this happens however the 
value selected does not get sent into the property of the component. I am 
assuming this is thanks to the "feature" decribed here 
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html 
thussly : 
> 
> "If true, then the field will render out with a disabled attribute (to 
turn off client-side behavior). Further, a disabled field ignores any 
value in the request when the form is submitted. "
> 
> So how to set the select value to disabled initially but not make it 
stay that way for ever?
> 
> Thanks in advance for your ideas, I have resorted to adding a little 
javascript that sets it so on load but that is a bit of hack for some 
fairly simple functionality.
> 
> Any reason WHY "Further, a disabled field ignores any value in the 
request when the form is submitted." this seems to offer zero advantage 
and loads of problems
> 
> Cheers
> 
> Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



Re: T5: t:select how to disable and re-enable

Posted by Andy Pahne <ap...@net22.de>.
Maybe it's possible that you disable your select only clientside?
If you do so there won't be any problems if you later on enable it again.

Andy


Russell Brown schrieb:
> Hi,
> I am using a T5 select component. When the form renders I wish the select to be disabled so I use disabled="true" parameter. However, some javascript causes the field to become enabled. If this happens however the value selected does not get sent into the property of the component. I am assuming this is thanks to the "feature" decribed here http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html thussly : 
> 
> "If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a disabled field ignores any value in the request when the form is submitted. "
> 
> So how to set the select value to disabled initially but not make it stay that way for ever?
> 
> Thanks in advance for your ideas, I have resorted to adding a little javascript that sets it so on load but that is a bit of hack for some fairly simple functionality.
> 
> Any reason WHY "Further, a disabled field ignores any value in the request when the form is submitted." this seems to offer zero advantage and loads of problems
> 
> Cheers
> 
> Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org