You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Holloway <bi...@gmail.com> on 2006/11/20 02:27:49 UTC

tapestry.form.cancel not working

I have a very simple setup to reproduce a bug here.  Summary:
invoking tapestry.form.cancel from the onclick handler of a form's
button (any button) gives javascript error in FireFox that the form's
id is not defined; e.g., "sampleForm is not defined".  Here's my
template:

<html jwcid="@Shell" title="Dialog Test">
<body jwcid="@Body">

    <a jwcid="@DirectLink" listener="listener:showDialog"
async="ognl:true">Show Dialog</a>

    <br /><br />

    <div jwcid="DialogContent@Dialog" hidden="prop:dialogHidden"
backgroundColor="black" opacity="0.7">

        <form jwcid="sampleForm@Form" success="listener:doFormSubmit"
cancel="listener:doFormCancel"
            updateComponents="ognl:{'DialogContent', 'sampleForm'}">

        	<input jwcid="@TextField" value="prop:someProp" />

            <input type="button" value="Cancel"
onclick="tapestry.form.cancel(sampleForm);" />

            <input jwcid="sampleFormSubmit@Submit" value="OK" />

        </form>

	</div>
</body>
</html>


Use ((Dialog)getComponent("DialogContent")).show() and ...hide() in
the showDialog and doFormCancel methods.  Clicking on the cancel
method results in no action and a message in Firefox's javascript
console that  "sampleForm" is not defined.

Cheers,
Bill

-- 
"Budgets are moral documents."

     -- Ann Richards

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


Re: tapestry.form.cancel not working

Posted by Bill Holloway <bi...@gmail.com>.
That's got it!  Thanks.

Bill

On 11/19/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> Without quotes the javascript interpreter will treat your sampleForm
> reference as being one to an object previously defined. I think you need to
> do something more like tapestry.form.cancel('sampleForm') to make it get
> treated as a string.
>
> On 11/19/06, Bill Holloway <bi...@gmail.com> wrote:
> >
> > I have a very simple setup to reproduce a bug here.  Summary:
> > invoking tapestry.form.cancel from the onclick handler of a form's
> > button (any button) gives javascript error in FireFox that the form's
> > id is not defined; e.g., "sampleForm is not defined".  Here's my
> > template:
> >
> > <html jwcid="@Shell" title="Dialog Test">
> > <body jwcid="@Body">
> >
> >     <a jwcid="@DirectLink" listener="listener:showDialog"
> > async="ognl:true">Show Dialog</a>
> >
> >     <br /><br />
> >
> >     <div jwcid="DialogContent@Dialog" hidden="prop:dialogHidden"
> > backgroundColor="black" opacity="0.7">
> >
> >         <form jwcid="sampleForm@Form" success="listener:doFormSubmit"
> > cancel="listener:doFormCancel"
> >             updateComponents="ognl:{'DialogContent', 'sampleForm'}">
> >
> >                 <input jwcid="@TextField" value="prop:someProp" />
> >
> >             <input type="button" value="Cancel"
> > onclick="tapestry.form.cancel(sampleForm);" />
> >
> >             <input jwcid="sampleFormSubmit@Submit" value="OK" />
> >
> >         </form>
> >
> >         </div>
> > </body>
> > </html>
> >
> >
> > Use ((Dialog)getComponent("DialogContent")).show() and ...hide() in
> > the showDialog and doFormCancel methods.  Clicking on the cancel
> > method results in no action and a message in Firefox's javascript
> > console that  "sampleForm" is not defined.
> >
> > Cheers,
> > Bill
> >
> > --
> > "Budgets are moral documents."
> >
> >      -- Ann Richards
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo/(and a dash of TestNG), team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
>


-- 
"Budgets are moral documents."

     -- Ann Richards

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


Re: tapestry.form.cancel not working

Posted by Jesse Kuhnert <jk...@gmail.com>.
Without quotes the javascript interpreter will treat your sampleForm
reference as being one to an object previously defined. I think you need to
do something more like tapestry.form.cancel('sampleForm') to make it get
treated as a string.

On 11/19/06, Bill Holloway <bi...@gmail.com> wrote:
>
> I have a very simple setup to reproduce a bug here.  Summary:
> invoking tapestry.form.cancel from the onclick handler of a form's
> button (any button) gives javascript error in FireFox that the form's
> id is not defined; e.g., "sampleForm is not defined".  Here's my
> template:
>
> <html jwcid="@Shell" title="Dialog Test">
> <body jwcid="@Body">
>
>     <a jwcid="@DirectLink" listener="listener:showDialog"
> async="ognl:true">Show Dialog</a>
>
>     <br /><br />
>
>     <div jwcid="DialogContent@Dialog" hidden="prop:dialogHidden"
> backgroundColor="black" opacity="0.7">
>
>         <form jwcid="sampleForm@Form" success="listener:doFormSubmit"
> cancel="listener:doFormCancel"
>             updateComponents="ognl:{'DialogContent', 'sampleForm'}">
>
>                 <input jwcid="@TextField" value="prop:someProp" />
>
>             <input type="button" value="Cancel"
> onclick="tapestry.form.cancel(sampleForm);" />
>
>             <input jwcid="sampleFormSubmit@Submit" value="OK" />
>
>         </form>
>
>         </div>
> </body>
> </html>
>
>
> Use ((Dialog)getComponent("DialogContent")).show() and ...hide() in
> the showDialog and doFormCancel methods.  Clicking on the cancel
> method results in no action and a message in Firefox's javascript
> console that  "sampleForm" is not defined.
>
> Cheers,
> Bill
>
> --
> "Budgets are moral documents."
>
>      -- Ann Richards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com