Hello again.
Sorry for the mails, but I've spent a lot of time trying to debug this,
and I'm just not sure where to go from here.
I've found the actual cause for the stale link:
com.primix.tapestry.StaleLinkException: Incorrect number iof elements
with form Test/form.
at com.primix.tapestry.form.Form.render(Form.java:510)
... etc
Is there a reason for this?
This is what happens on my page:
<form jwcid="form">
<span jwcid="miniCal"/>
</form>
miniCal generates links of the form:
<a href="javascript:onClick_Form0_miniCal_selectDay('05-01-02')">01</a>
and selectDay simply sets a hidden field (to the string parameter) and
submits the form. I am using ListEdit where applicable to iterate
through the weeks of the month.
My code is virtually identical to that of Palette (w.r.t. render() and
runScript()).
Any insight will be appreciated. BTW - has anyone actually done
something like this? Generate links dynamically within a form using
javascript and function parameters?
-Jason
On Wednesday, May 29, 2002, at 06:13 PM, Jason Owens wrote:
> Hello...
>
> Unfortunately, it wasn't that simple. I wasn't using the Script
> component, because I need access to the function from the script.
> However - if I do it the way Palette does it - I execute the script
> *before* the components are rendered - which means I can't get to the
> component names. But if I do it the Script component way, I can't get
> to the script's internal symbols.
>
> Finally - I just had to find the first component, render it, manually
> process the script, then continue rendering the remaining components.
>
> HOWEVER - it still doesn't work. Everything is as it should be. (I.e.
> if I weren't using tapestry) But I am getting stale link exceptions
> now. WHY??? Yes - I do have a visit object. I did not press the back
> button. My script is SIMPLY setting the value of the hidden
> (document.form.hidden.value = val), and then calling
> document.form.submit().
>
> Again - any help. I don't even know where to look to find out why I'm
> getting the stale link. It "look like" the context/parameters/service
> aren't going through.
>
> Perhaps it's just my frustration blinding me.
>
> -jason
>
> On Wednesday, May 29, 2002, at 07:12 PM, Howard M. Lewis Ship wrote:
>
>> 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
>
_______________________________________________________________
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