You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Diethelm Guallar, Gonzalo" <Go...@sonda.com> on 2001/06/13 19:00:22 UTC

Action_events from a link?

In a form, you can do something like:

  <form name="myForm" action="$link.setAction("myAction")">
    ...
    <input type="submit" name="eventSubmit_doFirst" value="First Action">
    <input type="submit" name="eventSubmit_doSecond" value="Second Action">
  </form>

and this will end up locating an Action class named myAction, and
calling its method doFirst() or doSecond(), depending on which
submit button was pressed. Very nice.

Is there any way to replace those buttons with links? In other
words, I would like to have two links:

  <a href="$link.MAGIC">First Action</a>
  <a href="$link.MAGIC">Second Action</a>

and have the first link act as the first submit button, and the
second link act as the second submit button. The problem I see
is that there is no way to specify the action for a link; MAGIC
can only be, as far as I know,

  setAction("myAction")

but that doesn't specify the method to call, and the link will
end up calling method doPerform().

If this is an accurate description for the way links are handled,
maybe this would be a good reason to add an alternative syntax
for specifying actions; for example:

  <a href="$link.setAction("myAction:doFirst")">First Action</a>
  <a href="$link.setAction("myAction:doSecond")">Second Action</a>

which could also be used instead of "eventSubmit_XXX":

<form name="myForm" action="$link.setAction("myAction")">
  ...
  <input type="submit" name=":doFirst" value="First Action">
  <input type="submit" name=":doSecond" value="Second Action">
</form>

Any hints or comments? Thanks,


-- 
Gonzalo A. Diethelm
gonzalo.diethelm@sonda.com

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Action_events from a link?

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/13/01 12:25 PM, "Ivan Stoev" <st...@sun-fish.com> wrote:

> Look into ActionEvent or try this:
> 
> 
> <a
> href="$link.setPage("Magic.vm").setAction("Action").addPathInfo("eventSu
> bmit_doMagic","magic")">magic</a>
> <a
> href="$link.setPage("Trick.vm").setAction("Action").addPathInfo("eventSu
> bmit_doTrick","trick")">trick</a>

Bingo.

People need to realize that Turbine (and the ParameterParser class) treats
get/post/path_info data exactly the same. This is a feature. :-)

So, passing something in as <form method="POST"> is the exact same as
passing something in as <form method="GET">.

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Action_events from a link?

Posted by Ivan Stoev <st...@sun-fish.com>.
Look into ActionEvent or try this:


<a
href="$link.setPage("Magic.vm").setAction("Action").addPathInfo("eventSu
bmit_doMagic","magic")">magic</a>
<a
href="$link.setPage("Trick.vm").setAction("Action").addPathInfo("eventSu
bmit_doTrick","trick")">trick</a>

> -----Original Message-----
> From: Diethelm Guallar, Gonzalo [mailto:Gonzalo.Diethelm@sonda.com] 
> Sent: Wednesday, June 13, 2001 7:00 PM
> To: 'turbine-user@jakarta.apache.org'
> Subject: Action_events from a link?
> 
> 
> In a form, you can do something like:
> 
>   <form name="myForm" action="$link.setAction("myAction")">
>     ...
>     <input type="submit" name="eventSubmit_doFirst" 
> value="First Action">
>     <input type="submit" name="eventSubmit_doSecond" 
> value="Second Action">
>   </form>
> 
> and this will end up locating an Action class named myAction, 
> and calling its method doFirst() or doSecond(), depending on 
> which submit button was pressed. Very nice.
> 
> Is there any way to replace those buttons with links? In 
> other words, I would like to have two links:
> 
>   <a href="$link.MAGIC">First Action</a>
>   <a href="$link.MAGIC">Second Action</a>
> 
> and have the first link act as the first submit button, and 
> the second link act as the second submit button. The problem 
> I see is that there is no way to specify the action for a 
> link; MAGIC can only be, as far as I know,
> 
>   setAction("myAction")
> 
> but that doesn't specify the method to call, and the link 
> will end up calling method doPerform().
> 
> If this is an accurate description for the way links are 
> handled, maybe this would be a good reason to add an 
> alternative syntax for specifying actions; for example:
> 
>   <a href="$link.setAction("myAction:doFirst")">First Action</a>
>   <a href="$link.setAction("myAction:doSecond")">Second Action</a>
> 
> which could also be used instead of "eventSubmit_XXX":
> 
> <form name="myForm" action="$link.setAction("myAction")">
>   ...
>   <input type="submit" name=":doFirst" value="First Action">
>   <input type="submit" name=":doSecond" value="Second Action"> </form>
> 
> Any hints or comments? Thanks,
> 
> 
> -- 
> Gonzalo A. Diethelm
> gonzalo.diethelm@sonda.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org