You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by spaway <su...@googlemail.com> on 2009/06/02 23:03:10 UTC

Submit Button on Form & Event Handler Actions

Dear List,

I have the submit button below on a form

<input type="submit" t:type="submit" t:id="submitButton" value="Submit" />

and the event handler below in the page class

@OnEvent(component="submitButton")
    Object onSubmitButton() {
        System.out.println("Submit button was pressed ...");
        User newUser = new User(this.userName, this.email);
        this.user = newUser;
        return nextAction.class;
    }


this method does not get called after click clicking the submit button.

could anybody help me with a solution?



Thanks

SPA

Re: Submit Button on Form & Event Handler Actions

Posted by "Clark H.Robert" <cl...@hotmail.com>.
Yeah,man ,this problem was caused because you hadn't add a event type for
this button.
THe default event type is "action" ,which means that your event handler
could be equal to following:
 @OnEvent(value="action" component="submitButton")
But things are a little different on Submit . The default event that it will
reply  is "selected" . Now changin 
it to following style:
 @OnEvent(value="selected" component="submitButton")

 
Have a sound Bingo~~


spaway wrote:
> 
> Dear List,
> 
> I have the submit button below on a form
> 
> <input type="submit" t:type="submit" t:id="submitButton" value="Submit" />
> 
> and the event handler below in the page class
> 
> @OnEvent(component="submitButton")
>     Object onSubmitButton() {
>         System.out.println("Submit button was pressed ...");
>         User newUser = new User(this.userName, this.email);
>         this.user = newUser;
>         return nextAction.class;
>     }
> 
> 
> this method does not get called after click clicking the submit button.
> 
> could anybody help me with a solution?
> 
> 
> 
> Thanks
> 
> SPA
> 
> 

-- 
View this message in context: http://www.nabble.com/Submit-Button-on-Form---Event-Handler-Actions-tp23842757p23939271.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Submit Button on Form & Event Handler Actions

Posted by Inge Solvoll <in...@gmail.com>.
You can put event="myEvent" on the submit button, and then you just need to
have a method (no annotation) in you java class named onMyEvent(). Your
event handler will be called before the regular form event handlers.

Or, the onSuccess() handler mentioned by Thiago.

On Wed, Jun 3, 2009 at 4:23 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 02 Jun 2009 18:03:10 -0300, spaway <su...@googlemail.com>
> escreveu:
>
>  could anybody help me with a solution?
>>
>
> I don't know what's wrong, but you don't need a Submit component to submit
> a form: just handle the EventConstants.SUCESS event from the form.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Submit Button on Form & Event Handler Actions

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 02 Jun 2009 18:03:10 -0300, spaway <su...@googlemail.com>  
escreveu:

> could anybody help me with a solution?

I don't know what's wrong, but you don't need a Submit component to submit  
a form: just handle the EventConstants.SUCESS event from the form.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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