You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matt Christensen <mc...@trifus.com> on 2003/04/23 17:48:09 UTC

Form Component Question

Our web developer just asked me a question about the Form component that 
I can't answer. The HTML rendered from the Form component seems to set 
the name attribute to Form0. Is there a way to override this? I don't 
see it listed in the documentation. If not, is the first tapestry form 
component on the page always going to be named Form0?

Eg: we are getting
<form name = "Form0">

and we want:
<form name = "FooForm">

We are using Tapestry 2.3.

Thanks,
Matt Christensen



Re: Form Component Question

Posted by Vladimir <vl...@profitsoft.com.ua>.
I suppose you should look to the source of org.apache.tapestry.form.Form. In
the version 2.4-alpha-5:

    protected void renderComponent(IMarkupWriter writer, IRequestCycle
cycle)
    {
        String actionId = cycle.getNextActionId();
        _name = "Form" + actionId;



----- Original Message -----
From: "Matt Christensen" <mc...@trifus.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, April 23, 2003 6:48 PM
Subject: Form Component Question


> Our web developer just asked me a question about the Form component that
> I can't answer. The HTML rendered from the Form component seems to set
> the name attribute to Form0. Is there a way to override this? I don't
> see it listed in the documentation. If not, is the first tapestry form
> component on the page always going to be named Form0?
>
> Eg: we are getting
> <form name = "Form0">
>
> and we want:
> <form name = "FooForm">
>
> We are using Tapestry 2.3.
>
> Thanks,
> Matt Christensen
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


Re: Form Component Question

Posted by Matt Christensen <mc...@trifus.com>.
That make sense. I'll have to take a look at the js subsystem. For the 
page in question, we should be OK with Form0, since it's a login page 
and won't ever have other forms on it.

It would be nice if the form name matched the component id, but I can 
see why that would neither solve the fundamental problem nor be a simple 
change to make.

Thanks for the help,
- Matt

Howard M. Lewis Ship wrote:

>Tapestry has a subsystem for generating JavaScript from a template.  It is
>best to use that. You plug your form object into the script and custom
>javascript is generated from it.  This is the best approach to insulate
>yourself from future changes to the framework or your application.
>
>For example, what if some pages in your app include a little search form at
>the top of the page?  The becomes Form0 and your form will be Form1.  You
>can see this on the Workbench example, where the form at the bottom of the
>page (that controls the debug output and the inspector) is sometimes Form0
>and sometimes Form1 depending on the page ... of course, that detail is not
>relevant to any of your code which is the whole point of Tapestry.
>
>One thing I might consider is to change the default name of the form to
>match the form's component id ... but this is not deterministic either,
>since anonymous forms are common, and the form id may be suffixed with a
>number to make it unique.
>
>This is a trivial change to the framework ... but a pain in the ass to
>update all the JUnit test suites!
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>
>
>
>  
>
>>-----Original Message-----
>>From: Matt Christensen [mailto:mchristensen@trifus.com] 
>>Sent: Wednesday, April 23, 2003 12:47 PM
>>To: Tapestry users
>>Subject: Re: Form Component Question
>>
>>
>>I think the designer wants to use some javascript with it.
>>
>>The exact name of the form is less important than that the 
>>form name is 
>>deterministic -- that is, that we can always count on Form0 
>>being Form0.
>>
>>Thanks,
>>Matt
>>
>>
>>
>>Howard M. Lewis Ship wrote:
>>
>>    
>>
>>>Is there a specific reason you wish to control the name of the form?
>>>
>>>--
>>>Howard M. Lewis Ship
>>>Creator, Tapestry: Java Web Components 
>>>http://jakarta.apache.org/tapestry
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Matt Christensen [mailto:mchristensen@trifus.com]
>>>>Sent: Wednesday, April 23, 2003 11:48 AM
>>>>To: Tapestry users
>>>>Subject: Form Component Question
>>>>
>>>>
>>>>Our web developer just asked me a question about the Form
>>>>component that 
>>>>I can't answer. The HTML rendered from the Form component 
>>>>seems to set 
>>>>the name attribute to Form0. Is there a way to override 
>>>>        
>>>>
>>this? I don't 
>>    
>>
>>>>see it listed in the documentation. If not, is the first 
>>>>tapestry form 
>>>>component on the page always going to be named Form0?
>>>>
>>>>Eg: we are getting
>>>><form name = "Form0">
>>>>
>>>>and we want:
>>>><form name = "FooForm">
>>>>
>>>>We are using Tapestry 2.3.
>>>>
>>>>Thanks,
>>>>Matt Christensen
>>>>
>>>>
>>>>
>>>>------------------------------------------------------------
>>>>        
>>>>
>>---------
>>    
>>
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: 
>>>>        
>>>>
>>tapestry-user-help@jakarta.apache.org
>>    
>>
>>>>   
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: 
>>>      
>>>
>>tapestry-user-help@jakarta.apache.org
>>    
>>
>>> 
>>>
>>>      
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>





RE: Form Component Question

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
Tapestry has a subsystem for generating JavaScript from a template.  It is
best to use that. You plug your form object into the script and custom
javascript is generated from it.  This is the best approach to insulate
yourself from future changes to the framework or your application.

For example, what if some pages in your app include a little search form at
the top of the page?  The becomes Form0 and your form will be Form1.  You
can see this on the Workbench example, where the form at the bottom of the
page (that controls the debug output and the inspector) is sometimes Form0
and sometimes Form1 depending on the page ... of course, that detail is not
relevant to any of your code which is the whole point of Tapestry.

One thing I might consider is to change the default name of the form to
match the form's component id ... but this is not deterministic either,
since anonymous forms are common, and the form id may be suffixed with a
number to make it unique.

This is a trivial change to the framework ... but a pain in the ass to
update all the JUnit test suites!

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Matt Christensen [mailto:mchristensen@trifus.com] 
> Sent: Wednesday, April 23, 2003 12:47 PM
> To: Tapestry users
> Subject: Re: Form Component Question
> 
> 
> I think the designer wants to use some javascript with it.
> 
> The exact name of the form is less important than that the 
> form name is 
> deterministic -- that is, that we can always count on Form0 
> being Form0.
> 
> Thanks,
> Matt
> 
> 
> 
> Howard M. Lewis Ship wrote:
> 
> >Is there a specific reason you wish to control the name of the form?
> >
> >--
> >Howard M. Lewis Ship
> >Creator, Tapestry: Java Web Components 
> >http://jakarta.apache.org/tapestry
> >
> >
> >
> >  
> >
> >>-----Original Message-----
> >>From: Matt Christensen [mailto:mchristensen@trifus.com]
> >>Sent: Wednesday, April 23, 2003 11:48 AM
> >>To: Tapestry users
> >>Subject: Form Component Question
> >>
> >>
> >>Our web developer just asked me a question about the Form
> >>component that 
> >>I can't answer. The HTML rendered from the Form component 
> >>seems to set 
> >>the name attribute to Form0. Is there a way to override 
> this? I don't 
> >>see it listed in the documentation. If not, is the first 
> >>tapestry form 
> >>component on the page always going to be named Form0?
> >>
> >>Eg: we are getting
> >><form name = "Form0">
> >>
> >>and we want:
> >><form name = "FooForm">
> >>
> >>We are using Tapestry 2.3.
> >>
> >>Thanks,
> >>Matt Christensen
> >>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >>
> >>    
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >
> >
> >  
> >
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Re: Form Component Question

Posted by Matt Christensen <mc...@trifus.com>.
I think the designer wants to use some javascript with it.

The exact name of the form is less important than that the form name is 
deterministic -- that is, that we can always count on Form0 being Form0.

Thanks,
Matt



Howard M. Lewis Ship wrote:

>Is there a specific reason you wish to control the name of the form?
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>
>
>
>  
>
>>-----Original Message-----
>>From: Matt Christensen [mailto:mchristensen@trifus.com] 
>>Sent: Wednesday, April 23, 2003 11:48 AM
>>To: Tapestry users
>>Subject: Form Component Question
>>
>>
>>Our web developer just asked me a question about the Form 
>>component that 
>>I can't answer. The HTML rendered from the Form component 
>>seems to set 
>>the name attribute to Form0. Is there a way to override this? I don't 
>>see it listed in the documentation. If not, is the first 
>>tapestry form 
>>component on the page always going to be named Form0?
>>
>>Eg: we are getting
>><form name = "Form0">
>>
>>and we want:
>><form name = "FooForm">
>>
>>We are using Tapestry 2.3.
>>
>>Thanks,
>>Matt Christensen
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>





RE: Form Component Question

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
Is there a specific reason you wish to control the name of the form?

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Matt Christensen [mailto:mchristensen@trifus.com] 
> Sent: Wednesday, April 23, 2003 11:48 AM
> To: Tapestry users
> Subject: Form Component Question
> 
> 
> Our web developer just asked me a question about the Form 
> component that 
> I can't answer. The HTML rendered from the Form component 
> seems to set 
> the name attribute to Form0. Is there a way to override this? I don't 
> see it listed in the documentation. If not, is the first 
> tapestry form 
> component on the page always going to be named Form0?
> 
> Eg: we are getting
> <form name = "Form0">
> 
> and we want:
> <form name = "FooForm">
> 
> We are using Tapestry 2.3.
> 
> Thanks,
> Matt Christensen
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>