You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Marcus <mv...@gmail.com> on 2007/11/01 06:20:34 UTC

T5 which button did you hit?

Hi,

SomePage.java:
...
public Object onSubmit() {  System.out.println("Button1");  }
public Object onSuccess()  {  System.out.println("Button 2"); }
...

SomePage.tml:
...
<form t:type="form">
  <input type="submit" value="Button 1">
</form>
<form t:type="BeanEditForm" object="somelist" submitLabel="Button 2">
</form>
...

localhost:8080/SomeTest/SomePage

How do you know, in java class, which button did you hit?
Console always display:
Button2
Button1

Thanks,

Marcus

Re: T5 which button did you hit?

Posted by Marcus <mv...@gmail.com>.
Hi Nick,

Thanks,

Marcus

Re: T5 which button did you hit?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Oops, that should be:
To get the "submit" event from the component named Submit, use:
onSubmitFromSubmit()

You can see it's better to give meaningful names to your components.

Cheers,
Nick.


Nick Westgate wrote:
> There are some docs about this here:
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/event.html
> 
> To get the "success" event from the component named Form, use:
> onSuccessFromForm()
> 
> To get the "submit" event from the component named Submit, so use:
> onSuccessFromSubmit()
> 
> It's good practice to add a t:id="ComponentName" to your components.
> (Otherwise the default name is the component type.) Then you can use:
> onEventFromComponentName()
> 
> Cheers,
> Nick.
> 
> 
> Marcus wrote:
>> Hi,
>>
>> SomePage.java:
>> ...
>> public Object onSubmit() {  System.out.println("Button1");  }
>> public Object onSuccess()  {  System.out.println("Button 2"); }
>> ...
>>
>> SomePage.tml:
>> ...
>> <form t:type="form">
>>   <input type="submit" value="Button 1">
>> </form>
>> <form t:type="BeanEditForm" object="somelist" submitLabel="Button 2">
>> </form>
>> ...
>>
>> localhost:8080/SomeTest/SomePage
>>
>> How do you know, in java class, which button did you hit?
>> Console always display:
>> Button2
>> Button1
>>
>> Thanks,
>>
>> Marcus
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 which button did you hit?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
There are some docs about this here:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/event.html

To get the "success" event from the component named Form, use:
onSuccessFromForm()

To get the "submit" event from the component named Submit, so use:
onSuccessFromSubmit()

It's good practice to add a t:id="ComponentName" to your components.
(Otherwise the default name is the component type.) Then you can use:
onEventFromComponentName()

Cheers,
Nick.


Marcus wrote:
> Hi,
> 
> SomePage.java:
> ...
> public Object onSubmit() {  System.out.println("Button1");  }
> public Object onSuccess()  {  System.out.println("Button 2"); }
> ...
> 
> SomePage.tml:
> ...
> <form t:type="form">
>   <input type="submit" value="Button 1">
> </form>
> <form t:type="BeanEditForm" object="somelist" submitLabel="Button 2">
> </form>
> ...
> 
> localhost:8080/SomeTest/SomePage
> 
> How do you know, in java class, which button did you hit?
> Console always display:
> Button2
> Button1
> 
> Thanks,
> 
> Marcus
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org