You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Engelhart <mo...@gmail.com> on 2005/03/02 00:50:06 UTC

dynamic javascript/DOM forms

Hi - 
I have a page where I want to create an empty form shell like this;

<form jwcid="@Form" listener="ognl:listeners.submitReview"
id="ognl:productId + '-review'"></form>

I then fill in the form elements (input, textarea, select, etc) with
javascript using DOM so I don't have to write the form over and over
for every item on the page.   I've done this very successfully on all
my non-Tapestry projects. I'm not really sure how to handle this.  
It's trivial to dynamically insert the form elements using DOM but
then these values aren't tied to anything in my page class.    Is
there a way to treat these forms as servlet type requests where I can
call a listener on form submit but access the values passed in from
the IRequestCycle as string parameters rather then trying to access
the fields of my page class.

I'm hoping there's an elegant Tapestry way to do this but I can't seem
to find anything.

Thanks
Mike

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


Re: dynamic javascript/DOM forms

Posted by Michael Engelhart <mo...@gmail.com>.
Thanks Kent!   That's exactly what I needed. 

Cheers
Mike


On Wed, 2 Mar 2005 03:12:24 +0000 (UTC), Kent Tong <ke...@cpttm.org.mo> wrote:
> Michael Engelhart <moosebrookfarm <at> gmail.com> writes:
> 
> > Is
> > there a way to treat these forms as servlet type requests where I can
> > call a listener on form submit but access the values passed in from
> > the IRequestCycle as string parameters rather then trying to access
> > the fields of my page class.
> 
> Sure, in your listener, get the parameters using
> cycle.getRequestContext().getParameter("myfieldname")
> 
> ---------------------------------------------------------------------
> 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: dynamic javascript/DOM forms

Posted by Kent Tong <ke...@cpttm.org.mo>.
Michael Engelhart <moosebrookfarm <at> gmail.com> writes:

> Is
> there a way to treat these forms as servlet type requests where I can
> call a listener on form submit but access the values passed in from
> the IRequestCycle as string parameters rather then trying to access
> the fields of my page class.

Sure, in your listener, get the parameters using 
cycle.getRequestContext().getParameter("myfieldname")



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