You need to place your Script after the other components render; the name is
assigned inside renderComponent() and persists afterwards.

This is the way it is because we don't know how many times a component will
render within the same form (i.e., the magic of Foreach).

BTW, welcome to the world of meta-programming ... where you program the
system how to program!


----- Original Message -----
From: "Jason Owens" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 1:35 PM
Subject: Re: [Tapestry-developer] Service / Form question


> Thanks for the reply Howard...
>
> I thought it would be something like that, but I didn't want to mess
> with Javascript.
>
> Nevertheless, I've almost got it working (after some studying of
> Palette...) - but I have a problem.
>
> In my render() method, I'm doing:
>
> symbols.put("hiddenComponent", getComponent("selectedDay"));
>
> ...
>
> and in my MiniCalendar.script file, I've got:
>
> <let key="hiddenName">
> <insert property-path="hiddenComponent.name"/>
> </let>
> <let key="hiddenPath">
> <insert property-path="formPath"/>.<insert property-path="hiddenName"/>
> </let>
>
> and
>
> <body>
> function <insert property-path="function"/>(var val) {
> <insert property-path="hiddenPath">.value = val;
> ...
> }
> </body>
>
> But it doesn't work. It seems that my selectedDay component is not
> getting a name, because this is what I get in the rendered page:
>
> document.Form0..value = val;
>
> Notice the hiddenName missing. I can't get it in there.
>
> Because I need to dynamically get the function name (like Palette does
> for the select/deselect buttons), I load the script like Palette. This
> means I can't bind the component using the SubmitScript example...
>
> Any suggestions?
>
> Thanks
> -Jason
>
>
> On Wednesday, May 29, 2002, at 07:39  AM, Howard M. Lewis Ship wrote:
>
> > This is less a Tapestry question than a general HTML question.  Links
> > and
> > links and forms are forms.
> >
> > Take a step back and picture what you would do if this was pure HTML.
> >
> > When the component is not inside a form, then you would have each link
> > simply pass along, directly, the selected date as part of a URL.
> >
> > When the component is inside a form, you would need client-side
> > JavaScript.
> > My approach would be to define a hidden field within the form;
> > clicking a
> > link will activate JavaScript to fill in the hidden field with the
> > appropriate value and then force the containing form to submit.
> >
> > Tapestry can do all of this.  In fact, your component can check to see
> > if it
> > is wrapped by a form and adjust automatically.
> >
> > Hope this helps,
> >
> > Howard
> >
> >
> > ----- Original Message -----
> > From: "Jason Owens" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, May 28, 2002 4:45 PM
> > Subject: [Tapestry-developer] Service / Form question
> >
> >
> >> Hello all,
> >>
> >> I'm relatively new to Tapestry (I'm using ver. 2.0)... and I just came
> >> across this problem and wondered if anyone knows how to fix it
> >> without a
> >> tremendous amount of work.
> >> What I want to do:
> >>
> >> I've built a nice 'mini calendar' component that allows a user to
> >> select a
> >> date range. It's *supposed* to be usable within and without a form.
> >> Each
> >> day is a Direct link (with a context of something like '05-28-02') so
> >> it
> >> can determine which day was selected. The assembler must specify the
> >> start
> >> date (java.util.Calendar) and end date as parameters. The component
> >> will
> >> call the setTime() mutator on the bound calendars when a day is
> >> selected.
> >> The problem:
> >>
> >> Now, I place the calendar in a form, and when the user selects a date -
> >> all the other components within the form are reset (including the bound
> >> Calendars)! Duh... stupid me. I know this has to do with the fact I
> >> used
> >> the Direct service. But how can I build that component without the
> >> Direct
> >> service? If I use Action, I lose the information for each day link.
> >> The main problem is that I'm not sure how to take the form's state
> >> along
> >> with me, especially when using a component that makes use of Direct in
> >> this manner. Is there some way to hook into the form's submit? From
> >> what I
> >> understand from reading the dev guide, I need to rewind the form to
> >> allow
> >> the components to do their thing... but can I trigger this off a Direct
> >> somehow?
> >> Any pointers will be appreciated.
> >>
> >> Thanks
> >> -Jason
> >>
> >>
> >>
> >> _______________________________________________________________
> >>
> >> Don't miss the 2002 Sprint PCS Application Developer's Conference
> >> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> >>
> >> _______________________________________________
> >> Tapestry-developer mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
> >
> >
> > _______________________________________________________________
> >
> > Don't miss the 2002 Sprint PCS Application Developer's Conference
> > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> >
> > _______________________________________________
> > Tapestry-developer mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/tapestry-developer
> >
>
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
>


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to