You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/10/22 16:12:10 UTC

T5: accessing fields in a nested form?

Hi,

I know nested form is not allowed in html, however I have a need for that, I
have a sub form embedded in the main form, the sub form will be replaced by
Ajax calls to obtain more specific forms depending on the country field, the
UI works quite well, but there is no way for me to access those form fields
in the sub form but I do have a Form variable pointing at sub form, you can
see from the code/template below:

@Component
private Form form_info;

@Component 
private Form form_sub;

<t:form t:id="main">
<label for="country">Country<input t:type="select"  t:id="country"
t:model="CountryList"/></label>
<div id="replacable">   
   <t:form t:id="sub">
  	  <label for="city">City<input t:type="textfield" t:id="city" size="20"
/></label>
  </t:form>
  
</div>
 <input t:type="submit" name="Submit" t:id="Submit" value="Submit"/>
</t:form>




-- 
View this message in context: http://www.nabble.com/T5%3A-accessing-fields-in-a-nested-form--tf4670540.html#a13342288
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: accessing fields in a nested form?

Posted by Josh Canfield <jo...@thedailytube.com>.
I don't entirely follow what you said. There are lots of resources on the
web for dynamically building forms.
 Here are a couple that you can start with.

http://developer.apple.com/internet/webcontent/dynamicforms.html
http://www.quirksmode.org/dom/usableforms.html


Josh

On 10/22/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi Josh,
>
> I'm now trying this Javascript approach, I need to position those fields
> differently depending on parameter, so I insert them runtime, however T5's
> page class will not recognize them, so I have to render all of them in the
> page and delete when page is loaded , add back those variables in the ajax
> call, is it correct this time? thanks.
>
> A.C.
>
>
> Josh Canfield-2 wrote:
> >
> >
> > Why do you need a nested form? Can you just add the fields you want
> > without
> > the form? If your possibilities are limited enough then just render them
> > all
> > in the page and disable/hide the ones you don't want submitted and use
> > plain-old-javascript to switch them out.
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-accessing-fields-in-a-nested-form--tf4670540.html#a13353955
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: accessing fields in a nested form?

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Josh,

I'm now trying this Javascript approach, I need to position those fields
differently depending on parameter, so I insert them runtime, however T5's
page class will not recognize them, so I have to render all of them in the
page and delete when page is loaded , add back those variables in the ajax
call, is it correct this time? thanks.

A.C.


Josh Canfield-2 wrote:
> 
> 
> Why do you need a nested form? Can you just add the fields you want
> without
> the form? If your possibilities are limited enough then just render them
> all
> in the page and disable/hide the ones you don't want submitted and use
> plain-old-javascript to switch them out.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-accessing-fields-in-a-nested-form--tf4670540.html#a13353955
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: accessing fields in a nested form?

Posted by Josh Canfield <jo...@thedailytube.com>.
>
> I know nested form is not allowed in html, however I have a need for that,


That's a fun statement... I know the spec doesn't allow it but I'm going to
do it anyway...

Why do you need a nested form? Can you just add the fields you want without
the form? If your possibilities are limited enough then just render them all
in the page and disable/hide the ones you don't want submitted and use
plain-old-javascript to switch them out.

I think in general it's a bad idea to do what you are asking for (sub-form)
because each random browser could handle it differently. For instance, what
happens when someone hits enter in your city text field? Is the inner form
submitted, or the outerform? When you submit the outer form, are the inner
forms fields going to be submitted too?

Good luck,
Josh


On 10/22/07, Angelo Chen <an...@yahoo.com.hk> wrote:

>
> Hi,
>
> I know nested form is not allowed in html, however I have a need for that,
> I
> have a sub form embedded in the main form, the sub form will be replaced
> by
> Ajax calls to obtain more specific forms depending on the country field,
> the
> UI works quite well, but there is no way for me to access those form
> fields
> in the sub form but I do have a Form variable pointing at sub form, you
> can
> see from the code/template below:
>
> @Component
> private Form form_info;
>
> @Component
> private Form form_sub;
>
> <t:form t:id="main">
> <label for="country">Country<input t:type="select"  t:id="country"
> t:model="CountryList"/></label>
> <div id="replacable">
>   <t:form t:id="sub">
>          <label for="city">City<input t:type="textfield" t:id="city"
> size="20"
> /></label>
> </t:form>
>
> </div>
> <input t:type="submit" name="Submit" t:id="Submit" value="Submit"/>
> </t:form>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-accessing-fields-in-a-nested-form--tf4670540.html#a13342288
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.