You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Norman Franke <no...@myasd.com> on 2009/07/06 20:02:20 UTC

T5 Hidden

I'm trying to use a Hidden component to allow my web page to  
automatically submit a login page if a browser-injected JavaScript  
object exists. (Allowing my web app to auto-login if run in my  
embedded web browser.)

I've created the field thusly:

	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>

However, it doesn't really work. The control never gets an "id" so  
Prototype can't find it to set the value.

First, why doesn't it get an ID (the submit button does) and is there  
a better way of doing this?

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com




Re: T5 Hidden

Posted by Robert Zeigler <ro...@scazdl.org>.
Hah! Nice... didn't realize that... let me look into this one.

Robert

On Jul 6, 2009, at 7/62:03 PM , Norman Franke wrote:

> Alas, one can't add a mixin to a t:hidden field. It claims that my  
> hidden field is not assignable to ClientElement.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
> On Jul 6, 2009, at 2:16 PM, Robert Zeigler wrote:
>
>> id isn't rendered because nowhere in the server-side code is  
>> "getClientId" called.
>> Check out:
>>
>> https://issues.apache.org/jira/browse/TAP5-680
>>
>> Which describes this.  There's a new mixin in the 5.2-SNAPSHOT  
>> branch (RenderClientId) that ensures the client id is rendered for  
>> a form element.
>> It's a small mixin that you can easily add yourself, if you want;  
>> otherwise, just be sure to call "getClientId" on the component  
>> instance from the server.
>>
>> Robert
>>
>> On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:
>>
>>> I'm trying to use a Hidden component to allow my web page to  
>>> automatically submit a login page if a browser-injected JavaScript  
>>> object exists. (Allowing my web app to auto-login if run in my  
>>> embedded web browser.)
>>>
>>> I've created the field thusly:
>>>
>>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>>>
>>> However, it doesn't really work. The control never gets an "id" so  
>>> Prototype can't find it to set the value.
>>>
>>> First, why doesn't it get an ID (the submit button does) and is  
>>> there a better way of doing this?
>>>
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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 Hidden

Posted by Norman Franke <no...@myasd.com>.
Glad I'm not going crazy!

https://issues.apache.org/jira/browse/TAP5-764

I've come up with a hack to get the element by name using  
document.getElementsByName().

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 6, 2009, at 4:18 PM, Robert Zeigler wrote:

> Awesome.  Not only does hidden not support ClientElement, it also  
> doesn't support informal parameters (thus explaining why id didn't  
> pass through!).
> Please add a ticket to improve the Hidden component in those ways.   
> As far as the "bug", the behavior of only rendering the client id if  
> getClientId is called for ClientElement's is documented (if I had a  
> minute, I could find where :).  This was a case of trade-off: most  
> elements don't actually need an id on them, even though tapestry  
> will assign them one, and that can have a decent impact on markup  
> size (especially if you're using anonymous components! eg,  
> id="textfield", id="textfield-0" and so forth).  So the way (most)  
> tapestry components distinguish between needing an id or not is  
> whether "getClientId" was called.
>
> Cheers,
>
> Robert
>
> On Jul 6, 2009, at 7/62:03 PM , Norman Franke wrote:
>
>> Alas, one can't add a mixin to a t:hidden field. It claims that my  
>> hidden field is not assignable to ClientElement.
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>> On Jul 6, 2009, at 2:16 PM, Robert Zeigler wrote:
>>
>>> id isn't rendered because nowhere in the server-side code is  
>>> "getClientId" called.
>>> Check out:
>>>
>>> https://issues.apache.org/jira/browse/TAP5-680
>>>
>>> Which describes this.  There's a new mixin in the 5.2-SNAPSHOT  
>>> branch (RenderClientId) that ensures the client id is rendered for  
>>> a form element.
>>> It's a small mixin that you can easily add yourself, if you want;  
>>> otherwise, just be sure to call "getClientId" on the component  
>>> instance from the server.
>>>
>>> Robert
>>>
>>> On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:
>>>
>>>> I'm trying to use a Hidden component to allow my web page to  
>>>> automatically submit a login page if a browser-injected  
>>>> JavaScript object exists. (Allowing my web app to auto-login if  
>>>> run in my embedded web browser.)
>>>>
>>>> I've created the field thusly:
>>>>
>>>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>>>>
>>>> However, it doesn't really work. The control never gets an "id"  
>>>> so Prototype can't find it to set the value.
>>>>
>>>> First, why doesn't it get an ID (the submit button does) and is  
>>>> there a better way of doing this?
>>>>
>>>> Norman Franke
>>>> Answering Service for Directors, Inc.
>>>> www.myasd.com
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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 Hidden

Posted by Robert Zeigler <ro...@scazdl.org>.
Awesome.  Not only does hidden not support ClientElement, it also  
doesn't support informal parameters (thus explaining why id didn't  
pass through!).
Please add a ticket to improve the Hidden component in those ways.  As  
far as the "bug", the behavior of only rendering the client id if  
getClientId is called for ClientElement's is documented (if I had a  
minute, I could find where :).  This was a case of trade-off: most  
elements don't actually need an id on them, even though tapestry will  
assign them one, and that can have a decent impact on markup size  
(especially if you're using anonymous components! eg, id="textfield",  
id="textfield-0" and so forth).  So the way (most) tapestry components  
distinguish between needing an id or not is whether "getClientId" was  
called.

Cheers,

Robert

On Jul 6, 2009, at 7/62:03 PM , Norman Franke wrote:

> Alas, one can't add a mixin to a t:hidden field. It claims that my  
> hidden field is not assignable to ClientElement.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
> On Jul 6, 2009, at 2:16 PM, Robert Zeigler wrote:
>
>> id isn't rendered because nowhere in the server-side code is  
>> "getClientId" called.
>> Check out:
>>
>> https://issues.apache.org/jira/browse/TAP5-680
>>
>> Which describes this.  There's a new mixin in the 5.2-SNAPSHOT  
>> branch (RenderClientId) that ensures the client id is rendered for  
>> a form element.
>> It's a small mixin that you can easily add yourself, if you want;  
>> otherwise, just be sure to call "getClientId" on the component  
>> instance from the server.
>>
>> Robert
>>
>> On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:
>>
>>> I'm trying to use a Hidden component to allow my web page to  
>>> automatically submit a login page if a browser-injected JavaScript  
>>> object exists. (Allowing my web app to auto-login if run in my  
>>> embedded web browser.)
>>>
>>> I've created the field thusly:
>>>
>>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>>>
>>> However, it doesn't really work. The control never gets an "id" so  
>>> Prototype can't find it to set the value.
>>>
>>> First, why doesn't it get an ID (the submit button does) and is  
>>> there a better way of doing this?
>>>
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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 Hidden

Posted by Norman Franke <no...@myasd.com>.
Alas, one can't add a mixin to a t:hidden field. It claims that my  
hidden field is not assignable to ClientElement.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 6, 2009, at 2:16 PM, Robert Zeigler wrote:

> id isn't rendered because nowhere in the server-side code is  
> "getClientId" called.
> Check out:
>
> https://issues.apache.org/jira/browse/TAP5-680
>
> Which describes this.  There's a new mixin in the 5.2-SNAPSHOT  
> branch (RenderClientId) that ensures the client id is rendered for a  
> form element.
> It's a small mixin that you can easily add yourself, if you want;  
> otherwise, just be sure to call "getClientId" on the component  
> instance from the server.
>
> Robert
>
> On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:
>
>> I'm trying to use a Hidden component to allow my web page to  
>> automatically submit a login page if a browser-injected JavaScript  
>> object exists. (Allowing my web app to auto-login if run in my  
>> embedded web browser.)
>>
>> I've created the field thusly:
>>
>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>>
>> However, it doesn't really work. The control never gets an "id" so  
>> Prototype can't find it to set the value.
>>
>> First, why doesn't it get an ID (the submit button does) and is  
>> there a better way of doing this?
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5 Hidden

Posted by Norman Franke <no...@myasd.com>.
That seems to be the problem, thanks!

Still, that sounds like a bug. If I explicitly put in a "id='foo'"  
then it should be rendered regardless. Given the "fix version", will  
this be fixed in 5.2? Better to do so without a mixin, as this is not  
both non-obvious and breaks the "sane defaults" rule of Tapestry's  
design.

Next, why doesn't Hidden inherit from ClientElement? I can't inject  
the component and then call getClientId() since it doesn't have such a  
method.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 6, 2009, at 2:16 PM, Robert Zeigler wrote:

> id isn't rendered because nowhere in the server-side code is  
> "getClientId" called.
> Check out:
>
> https://issues.apache.org/jira/browse/TAP5-680
>
> Which describes this.  There's a new mixin in the 5.2-SNAPSHOT  
> branch (RenderClientId) that ensures the client id is rendered for a  
> form element.
> It's a small mixin that you can easily add yourself, if you want;  
> otherwise, just be sure to call "getClientId" on the component  
> instance from the server.
>
> Robert
>
> On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:
>
>> I'm trying to use a Hidden component to allow my web page to  
>> automatically submit a login page if a browser-injected JavaScript  
>> object exists. (Allowing my web app to auto-login if run in my  
>> embedded web browser.)
>>
>> I've created the field thusly:
>>
>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>>
>> However, it doesn't really work. The control never gets an "id" so  
>> Prototype can't find it to set the value.
>>
>> First, why doesn't it get an ID (the submit button does) and is  
>> there a better way of doing this?
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5 Hidden

Posted by Robert Zeigler <ro...@scazdl.org>.
id isn't rendered because nowhere in the server-side code is  
"getClientId" called.
Check out:

https://issues.apache.org/jira/browse/TAP5-680

Which describes this.  There's a new mixin in the 5.2-SNAPSHOT branch  
(RenderClientId) that ensures the client id is rendered for a form  
element.
It's a small mixin that you can easily add yourself, if you want;  
otherwise, just be sure to call "getClientId" on the component  
instance from the server.

Robert

On Jul 6, 2009, at 7/61:02 PM , Norman Franke wrote:

> I'm trying to use a Hidden component to allow my web page to  
> automatically submit a login page if a browser-injected JavaScript  
> object exists. (Allowing my web app to auto-login if run in my  
> embedded web browser.)
>
> I've created the field thusly:
>
> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>
> However, it doesn't really work. The control never gets an "id" so  
> Prototype can't find it to set the value.
>
> First, why doesn't it get an ID (the submit button does) and is  
> there a better way of doing this?
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>


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


Re: T5 Hidden

Posted by Norman Franke <no...@myasd.com>.
I tried that first, but T5 seems to strip it out as well. It does put  
in a name="loginId", but that's not really useful.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 6, 2009, at 2:06 PM, Thiago H. de Paula Figueiredo wrote:

> Em Mon, 06 Jul 2009 15:02:20 -0300, Norman Franke <no...@myasd.com>  
> escreveu:
>> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>
>
> Just add an id attribute to it. :)
> <input t:type="Hidden" t:id="login_id" value="${loginId}"  
> id="login_id"/>
>
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5 Hidden

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 06 Jul 2009 15:02:20 -0300, Norman Franke <no...@myasd.com>  
escreveu:
> 	<input t:type="Hidden" t:id="login_id" value="${loginId}"/>

Just add an id attribute to it. :)
<input t:type="Hidden" t:id="login_id" value="${loginId}" id="login_id"/>

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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