You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Karthik N <ka...@gmail.com> on 2006/08/04 14:44:46 UTC

Forcing all @If to evaluate to True on Form Submit

I have a rather bizzare requirement  (I think)

My Form has 3 or 4 @If components.  At any point only one of the @If is
True, all others are false.

But, for a particular Submit button I want all the @If to force-evaluate to
True on the Rewind.

One ugly way is to actually change the HTML using javascript so that all the
@Ifs have 'True' set in their values.

But is there a more elegant way?

If not, I guess I'll have to write my own custom component.

Thanks, Karthik

Re: Forcing all @If to evaluate to True on Form Submit

Posted by Karthik N <ka...@gmail.com>.
Bear with me it's a long description

I want to use Dojo's TabContainer.  But I want to implement lazy tab
loading.  by that I mean that all contents of all tabs will not be loaded.

Here is the approach I follow:

1) I have two forms.  The first Form encompasses the TabContainer and has a
Submit button to save all details for all tabs

2) The Second Form has one AjaxSubmit button, for each Tab.  The
responsibility of the Ajax submit button is to update the Tab it corresponds
to in Form 1.   Hence the updateComponents of each AjaxSubmit button
corresponds to each div tag for each Tab.  Of course I make all this
invisible so the user doesn't see it.

3) I use dojo's event system to intercept tab.show and fire off an ajax
submit via a javascript click on the corresponding AjaxSubmit button for
Form 2.  Tacos updateComponents takes care of partial refresh of only that
Tab.

4) Why do I have two forms?  I want to avoid the Rewind cycle for Form 1.
So a Form 2 submit will not cause Form 1 data to rewind.  That way dirty
Form 1 Data will not make its way to the server.

5) Why do I need @If - I use an @If to stifle the render - so if I am
refreshing Tab 3, the @If for Tab 1, Tab 2 etc. will be False.  That way I
make the render also "lazy", or rather "selective"

6) Why do I need all @If to be true finally?  When I submit Form 1, I want
the complete Rewind Cycle to kick in for the entire Form, so that all
properties are set



On 8/4/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Perhaps we could be more helpful if you told us what the general purpose
> of
> your logic is? (ie does it have to do with validation?)
>
> On 8/4/06, Karthik N <ka...@gmail.com> wrote:
> >
> > I have a rather bizzare requirement  (I think)
> >
> > My Form has 3 or 4 @If components.  At any point only one of the @If is
> > True, all others are false.
> >
> > But, for a particular Submit button I want all the @If to force-evaluate
> > to
> > True on the Rewind.
> >
> > One ugly way is to actually change the HTML using javascript so that all
> > the
> > @Ifs have 'True' set in their values.
> >
> > But is there a more elegant way?
> >
> > If not, I guess I'll have to write my own custom component.
> >
> > Thanks, Karthik
> >
> >
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>


-- 
Thanks, Karthik

Re: Forcing all @If to evaluate to True on Form Submit

Posted by Jesse Kuhnert <jk...@gmail.com>.
Perhaps we could be more helpful if you told us what the general purpose of
your logic is? (ie does it have to do with validation?)

On 8/4/06, Karthik N <ka...@gmail.com> wrote:
>
> I have a rather bizzare requirement  (I think)
>
> My Form has 3 or 4 @If components.  At any point only one of the @If is
> True, all others are false.
>
> But, for a particular Submit button I want all the @If to force-evaluate
> to
> True on the Rewind.
>
> One ugly way is to actually change the HTML using javascript so that all
> the
> @Ifs have 'True' set in their values.
>
> But is there a more elegant way?
>
> If not, I guess I'll have to write my own custom component.
>
> Thanks, Karthik
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.