Hi mark.
Sorry for any confusion: that was just an example from my code.
Please look carefully at the documentation for LinkSubmit.
"selected" is an expression (i.e. OGNL) identifying a variable to assign.
"tag" should be of the same type, and is the value assigned to "selected".
I use a page property of type String:
<property-specification name="submitTarget" type="java.lang.String"/>
...
<binding name="selected" expression="submitTarget"/>
But any type could be used using OGNL syntax, e.g. an array:
<binding name="selected" expression="{1, 'some string',
somePropertyName}"/>
Just make sure "selected" is of the same type as "expression".
You can add the "listener" parameter if you want to specify a
particular listener. In Tapestry 3 the usual caveats of form
rewind apply with respect to ordering of components in the form.
In Tapestry 4 you don't have to worry about this.
I'm still using Tapestry 3 where a safer way is to check
"selected" in the form listener. This is invoked after all
form components have been processed.
For strings, I use a form listener something like this:
public void submitForm(IRequestCycle cycle)
{
// get the form action
String submitTarget = getSubmitTarget();
if (submitTarget == null)
{
// javascript based form submit (eg PropertySelection)
}
else if (submitTarget.startsWith(deleteFormAction))
{
// delete
...
Cheers,
Nick.
Mark Stang wrote:
> Nick,
> That looks like a very interesting solution. Could you explain which values
> are which?
>
> I subsituted your code into my environment and it wants deleteFormAction to
> be a static variable on "my.project.PatientEdit". I tried to get it to call
> my method, but my method is a listener. So, I don't want to put a static
> variable in my class and if I create a method without the "IRequestCycle
> cycle", how do I get which was the selected item?
>
> thanks,
>
> Mark
>
> -----Original Message-----
> From: Nick Westgate [mailto:[EMAIL PROTECTED]
> Sent: Thu 8/18/2005 4:09 AM
> To: Tapestry users
> Subject: Re: LinkSubmit not passing in arguments
>
> Hi Mark and Muhariz.
>
> Have you considered using the LinkSubmit selected and tab parameters?
>
> <component id="deleteLink" type="LinkSubmit">
> <binding name="selected" expression="submitTarget"/>
> <binding name="tag" expression="@[EMAIL PROTECTED]"/>
> </component>
>
> I'm using a string because I like to do naughty things: adding extra
> 'parameters' to the string and parsing it later. But the certified Tapestry
> Way
> would be to use an array type or some other object that suits you if you have
> more than one 'parameter' to pass.
>
> Tag gets assigned to selected before the component or form listener is called.
> Then you can grab your 'parameters' from selected.
>
> Does this do what you need?
>
> Cheers,
> Nick.
>
>
> Mark Stang wrote:
>
>>Hi,
>>I have the same problem.
>>
>>The issue is that DirectLink allows you to create the link in the HTML page
>>with parameters. When you click on that link, the page is NOT submitted,
>>rather control is transferred to whereever the link is pointing to and it
>>only passes the parameters in the link. Those parameters were created when
>>the HTML was generated by Tapestry. Therefore any changes you have made to
>>the data on the screen can NOT be in those links.
>>
>>With LinkSubmit it is very similar. A LinkSubmit causes the whole form to be
>>submitted with all of your changes packaged up and sent to Tapestry to post
>>into your variables. However, the fact that you clicked on a Link and the
>>parameters from that link are NOT sent along which is why you get "0". What
>>you need is something called a Parameterized Link Submit. The current
>>LinkSubmit does NOT allow you to specify a Parameter.
>>
>>Link Submit Definition of available Parameters: (see
>>http://jakarta.apache.org/tapestry/3.0.3/doc/ComponentReference/LinkSubmit.html)
>>Parameters
>>Name Type Direction Required Default Description
>>disabled boolean in no false Controls whether the
>>link is produced. If disabled, the portion of the template the link surrounds
>>is still rendered, but not the link itself.
>>selected Object out no This parameter is bound to a
>>property that is updated when the submit button is clicked by the user. The
>>property is updated to match the tag parameter.
>>tag Object in no Tag used with the selected parameter to
>>indicate which Submit button on a form was clicked.
>>listener IActionListener in no If specified,
>>the listener is notified. This notification occurs as the component is
>>rewinded, i.e., prior to the Form's listener. In addition, the selected
>>property (if bound) will be updated before the listener is notified.
>>
>>So, there is NO way to specify which link was clicked.
>>
>>Glen posted a modified LinkSubmit that allows you to pass in parameters. I
>>haven't had any luck getting it to work properly. Here is the link
>>
>>http://www.jroller.com/page/gstamp/20050514
>>
>>Good Luck and if you it working let me know ;-). I think part of my issue
>>with it is that I have conditional elements on my page and it is causing me
>>grief.
>>
>>regards,
>>
>>Mark
>>
>>
>>-----Original Message-----
>>From: Muhariz Jabeer [mailto:[EMAIL PROTECTED]
>>Sent: Wed 8/17/2005 12:46 PM
>>To: Tapestry users
>>Subject: LinkSubmit not passing in arguments
>>
>>hi guys,
>>
>>I have this problem where i have to use LinkSubmit instead of DirectLinks to
>>keep persistence within a set of tabs in an application.
>>The problem i am having is, if i use DirectLink, the parameters arguement
>>can be used to pass information. However, LinkSubmit doesnt
>>allow me to pass parameters to the server. Everytime i try to get the
>>serviceParameters( ) from the listener, i get a "0"?
>>
>>Any ideas how i can make LinkSubmit work for me? Basically i need to pass a
>>String from my Tab Component to the server, I'm using DirectLink
>>now, but i really need it to be a submission to the server when u click any
>>of the links.
>>
>>
>>Thanks a lot,
>>any help would be much appreciated.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]