You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Schneider <er...@centralparksoftware.com> on 2003/06/24 21:43:41 UTC

Conditional Form elements/Stale Link page

Hi,

I have a stateless form with a radio button group.   The radio buttons have
a onClick event that submits the form.  Based on the users selection,
additional form elements are shown (and in some cases suppressed with
Conditionals).   Unfortunatley, this doesn't work.  When the form is
submitted (after selecting a radio button) I always get the "stale link"
page.  The form behaves as expected if I remove the conditionals (which of
course this doesn't solve my problem).

Anyone know how I can avoid the problem I'm having?

Thanks in advance,
Eric


Re: Conditional Form elements/Stale Link page

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I definitely like the idea of FormConditional, but I don't like the idea 
of letting the developer make a choice between Conditional and 
FormConditional. But also, changing the definition of a basic component 
in beta, I think, would shun away people from using future beta 
versions. May be there should be a FormConditional now that can be 
deprecated and the functionality integrated into Conditional in 3.1.

Thanks
Harish

PS. I really appreciate the opportunity that Tapestry gives its users to 
voice their opinion.


Howard M. Lewis Ship wrote:

>I was thinking about this on the drive home.
>
>First off: shadow variables.  If you want to have:
>
><input jwcid="@Checkbox" selected="ognl:a">
><span jwcid="@Conditional" condition="ognl:a">
>...
></span>
>
>That's a problem.  When the form rewinds, if the user has clicked the checkbox, then the content of
>the conditional either renders or doesn't ... but doesn't
>match the original render.  Fall down, go boom.
>
>Now let's imagine that before we render we set property b to match property a:
>
><input jwcid="@Checkbox" selected="ognl:a">
><span jwcid="@Conditional" condition="ognl:b">
>...
></span>
>
>b shadows a.  As long as we set b properly before we rewind, then the rewind will match the original
>render, even if the user changes property a.
>In the form listener, we update b from a once it is safe.
>
>Thought #1:
>
>How about a FormConditional component?  Similar to the relationship between Foreach and ListEdit.
>On render, the FC reads a, stores it into a hidden field, and renders or doesn't appropriately.
>On rewind, the FC ignores a, reads the stored value, and renders or doesn't appropriately (matching
>the render no matter what).
>
>Thought #2:
>
>Change the Conditional component to do exactly that: if inside a Form then do what I just described
>for FC.
>
>Thought #3:
>
>That's a bigger change than I'm comfortable for in a beta.  I'd still like to do it, but from a
>community sense, I want to put it to a vote.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>
>
>
>  
>
>>-----Original Message-----
>>From: Eric Schneider [mailto:eric@centralparksoftware.com] 
>>Sent: Wednesday, June 25, 2003 9:01 AM
>>To: Tapestry users
>>Subject: Re: Conditional Form elements/Stale Link page
>>
>>
>>Hi Howard,
>>
>>    
>>
>>>You need to use "shadow variables" to store these 
>>>      
>>>
>>conditionals, such 
>>    
>>
>>>that
>>>      
>>>
>>they don't take effect
>>    
>>
>>>until the form's listener is invoked.
>>>      
>>>
>>Can you elaborate?  I'm not 100% sure what you mean about 
>>"shadow variables".  Are they just additional instance 
>>variables?  Not sure how this has anything to do with the 
>>number of elements in a form.
>>
>>Thanks,
>>Eric
>>
>>----- Original Message -----
>>From: "Howard M. Lewis Ship" <hl...@attbi.com>
>>To: "'Tapestry users'" <ta...@jakarta.apache.org>
>>Sent: Wednesday, June 25, 2003 7:24 AM
>>Subject: RE: Conditional Form elements/Stale Link page
>>
>>
>>    
>>
>>>You have to make the rewind of the form match the initial 
>>>      
>>>
>>form render.
>>    
>>
>>>When you have conditionals in your form, this can be tricky.
>>>
>>>You need to use "shadow variables" to store these 
>>>      
>>>
>>conditionals, such 
>>    
>>
>>>that
>>>      
>>>
>>they don't take effect
>>    
>>
>>>until the form's listener is invoked.
>>>
>>>--
>>>Howard M. Lewis Ship
>>>Creator, Tapestry: Java Web Components 
>>>http//jakarta.apache.org/tapestry
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Eric Schneider [mailto:eric@centralparksoftware.com]
>>>>Sent: Tuesday, June 24, 2003 3:44 PM
>>>>To: tapestry-user@jakarta.apache.org
>>>>Subject: Conditional Form elements/Stale Link page
>>>>
>>>>
>>>>Hi,
>>>>
>>>>I have a stateless form with a radio button group.   The
>>>>radio buttons have
>>>>a onClick event that submits the form.  Based on the users 
>>>>selection, additional form elements are shown (and in some cases 
>>>>suppressed with
>>>>Conditionals).   Unfortunatley, this doesn't work.  When 
>>>>        
>>>>
>>the form is
>>    
>>
>>>>submitted (after selecting a radio button) I always get 
>>>>        
>>>>
>>the "stale 
>>    
>>
>>>>link" page.  The form behaves as expected if I remove the 
>>>>conditionals (which of course this doesn't solve my problem).
>>>>
>>>>Anyone know how I can avoid the problem I'm having?
>>>>
>>>>Thanks in advance,
>>>>Eric
>>>>
>>>>
>>>>
>>>>        
>>>>
>>--------------------------------------------------------------------
>>    
>>
>>>>-
>>>>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: Conditional Form elements/Stale Link page

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
I was thinking about this on the drive home.

First off: shadow variables.  If you want to have:

<input jwcid="@Checkbox" selected="ognl:a">
<span jwcid="@Conditional" condition="ognl:a">
...
</span>

That's a problem.  When the form rewinds, if the user has clicked the checkbox, then the content of
the conditional either renders or doesn't ... but doesn't
match the original render.  Fall down, go boom.

Now let's imagine that before we render we set property b to match property a:

<input jwcid="@Checkbox" selected="ognl:a">
<span jwcid="@Conditional" condition="ognl:b">
...
</span>

b shadows a.  As long as we set b properly before we rewind, then the rewind will match the original
render, even if the user changes property a.
In the form listener, we update b from a once it is safe.

Thought #1:

How about a FormConditional component?  Similar to the relationship between Foreach and ListEdit.
On render, the FC reads a, stores it into a hidden field, and renders or doesn't appropriately.
On rewind, the FC ignores a, reads the stored value, and renders or doesn't appropriately (matching
the render no matter what).

Thought #2:

Change the Conditional component to do exactly that: if inside a Form then do what I just described
for FC.

Thought #3:

That's a bigger change than I'm comfortable for in a beta.  I'd still like to do it, but from a
community sense, I want to put it to a vote.

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



> -----Original Message-----
> From: Eric Schneider [mailto:eric@centralparksoftware.com] 
> Sent: Wednesday, June 25, 2003 9:01 AM
> To: Tapestry users
> Subject: Re: Conditional Form elements/Stale Link page
> 
> 
> Hi Howard,
> 
> > You need to use "shadow variables" to store these 
> conditionals, such 
> > that
> they don't take effect
> > until the form's listener is invoked.
> 
> Can you elaborate?  I'm not 100% sure what you mean about 
> "shadow variables".  Are they just additional instance 
> variables?  Not sure how this has anything to do with the 
> number of elements in a form.
> 
> Thanks,
> Eric
> 
> ----- Original Message -----
> From: "Howard M. Lewis Ship" <hl...@attbi.com>
> To: "'Tapestry users'" <ta...@jakarta.apache.org>
> Sent: Wednesday, June 25, 2003 7:24 AM
> Subject: RE: Conditional Form elements/Stale Link page
> 
> 
> > You have to make the rewind of the form match the initial 
> form render.
> >
> > When you have conditionals in your form, this can be tricky.
> >
> > You need to use "shadow variables" to store these 
> conditionals, such 
> > that
> they don't take effect
> > until the form's listener is invoked.
> >
> > --
> > Howard M. Lewis Ship
> > Creator, Tapestry: Java Web Components 
> > http//jakarta.apache.org/tapestry
> >
> >
> >
> > > -----Original Message-----
> > > From: Eric Schneider [mailto:eric@centralparksoftware.com]
> > > Sent: Tuesday, June 24, 2003 3:44 PM
> > > To: tapestry-user@jakarta.apache.org
> > > Subject: Conditional Form elements/Stale Link page
> > >
> > >
> > > Hi,
> > >
> > > I have a stateless form with a radio button group.   The
> > > radio buttons have
> > > a onClick event that submits the form.  Based on the users 
> > > selection, additional form elements are shown (and in some cases 
> > > suppressed with
> > > Conditionals).   Unfortunatley, this doesn't work.  When 
> the form is
> > > submitted (after selecting a radio button) I always get 
> the "stale 
> > > link" page.  The form behaves as expected if I remove the 
> > > conditionals (which of course this doesn't solve my problem).
> > >
> > > Anyone know how I can avoid the problem I'm having?
> > >
> > > Thanks in advance,
> > > Eric
> > >
> > >
> > > 
> --------------------------------------------------------------------
> > > -
> > > 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: Conditional Form elements/Stale Link page

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi Howard,

> You need to use "shadow variables" to store these conditionals, such that
they don't take effect
> until the form's listener is invoked.

Can you elaborate?  I'm not 100% sure what you mean about "shadow
variables".  Are they just additional instance variables?  Not sure how this
has anything to do with the number of elements in a form.

Thanks,
Eric

----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Wednesday, June 25, 2003 7:24 AM
Subject: RE: Conditional Form elements/Stale Link page


> You have to make the rewind of the form match the initial form render.
>
> When you have conditionals in your form, this can be tricky.
>
> You need to use "shadow variables" to store these conditionals, such that
they don't take effect
> until the form's listener is invoked.
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Eric Schneider [mailto:eric@centralparksoftware.com]
> > Sent: Tuesday, June 24, 2003 3:44 PM
> > To: tapestry-user@jakarta.apache.org
> > Subject: Conditional Form elements/Stale Link page
> >
> >
> > Hi,
> >
> > I have a stateless form with a radio button group.   The
> > radio buttons have
> > a onClick event that submits the form.  Based on the users
> > selection, additional form elements are shown (and in some
> > cases suppressed with
> > Conditionals).   Unfortunatley, this doesn't work.  When the form is
> > submitted (after selecting a radio button) I always get the
> > "stale link" page.  The form behaves as expected if I remove
> > the conditionals (which of course this doesn't solve my problem).
> >
> > Anyone know how I can avoid the problem I'm having?
> >
> > Thanks in advance,
> > Eric
> >
> >
> > ---------------------------------------------------------------------
> > 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: Conditional Form elements/Stale Link page

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
You have to make the rewind of the form match the initial form render.

When you have conditionals in your form, this can be tricky.

You need to use "shadow variables" to store these conditionals, such that they don't take effect
until the form's listener is invoked.

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



> -----Original Message-----
> From: Eric Schneider [mailto:eric@centralparksoftware.com] 
> Sent: Tuesday, June 24, 2003 3:44 PM
> To: tapestry-user@jakarta.apache.org
> Subject: Conditional Form elements/Stale Link page
> 
> 
> Hi,
> 
> I have a stateless form with a radio button group.   The 
> radio buttons have
> a onClick event that submits the form.  Based on the users 
> selection, additional form elements are shown (and in some 
> cases suppressed with
> Conditionals).   Unfortunatley, this doesn't work.  When the form is
> submitted (after selecting a radio button) I always get the 
> "stale link" page.  The form behaves as expected if I remove 
> the conditionals (which of course this doesn't solve my problem).
> 
> Anyone know how I can avoid the problem I'm having?
> 
> Thanks in advance,
> Eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>