You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Henrik von Schlanbusch <he...@enovate.no> on 2012/10/05 07:41:42 UTC

Posting from multiple submits

Hi. I have problems understanding multiple submits. I am running T5.3.5.

I have the following tml:

<t:zone t:id="singleUserRegistrationFormZone" 
id="singleUserRegistrationFormZone">
        <t:form t:id="singleUserRegistrationForm" 
zone="singleUserRegistrationFormZone">
		<t:submit t:id="setSelectedGroup"/>
                <t:submit t:id="sendUserRegistration" value="${signupLabel}"/>
        </t:form>
</zone>


And javacode:



 @Component
    private Submit setSelectedGroup;

    @Component
    private Submit sendUserRegistration;

    public void onSelectedFromSetSelectedGroup() {
        getLog().info("SELECT GROUP: " + selectedGroup);
    }

    public void onSelectedFromSendUserRegistration() {
        getLog().info("SELECT Userre: " + selectedGroup);
    }

    public Object onSuccessFromSingleUserRegistrationForm() {
        getLog().info("SUCCESS - SINGLE USER REGISTRATION");

    }

>From what I understand of the documentation, when clicking on the 
setSelectedGroup,
the method "onSelectedFromSetSelectedGroup" should be run first, then the 
onSuccessFromSingleUserRegistrationForm(). When observing from my debugger, 
the "onSelectedFromSetSelectedGroup" is never run. The click on the 
setSelectedGroup will consequently only run the success method of the 
form. So my question is: have I misunderstood the documentation, is it 
not possible to run different methods on the serverside from different 
buttons on the client? And if it is possible, can somebody help me in 
spotting where I have done something wrong?

-Henrik



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


Re: Posting from multiple submits

Posted by Ivan Khalopik <ik...@gmail.com>.
It seems that you have error in setSubmittingElement js function. This
function is responsible of functionality you need. It sets the id and name
of submit button the form was submitted from.

Hmm - I did not see this. This may be the source of my problems?


Yes, exactly. You have error in setSubmittingElement js function. This
function is responsible of functionality you need. It sets the id and name
of submit button the form was submitted from.

I use firefox 15.0.1. I expect that you do not get this error in your
> javascript console?


No, I have no errors. I tried this with firefox 15.0.1 and it works fine.
May be you have this errors because of some other thirdparty js stuff. I
recommend you to debug js code, especially setSubmittinElement() function.

-- 
BR
Ivan

Re: Posting from multiple submits

Posted by Henrik von Schlanbusch <he...@enovate.no>.
> Just tried your code and everething works as expected. Have you any client
> side errors reported by your browser?


Feil: TypeError: this.submitHidden is undefined
Kildefil: http://localhost:8080/adapt-it/assets/796296867807588e/core/tapestry.js
Linje: 1512

Hmm - I did not see this. This may be the source of my problems? I use firefox 
15.0.1. I expect that you do not get this error in your javascript console?

-Henrik


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


Re: Posting from multiple submits

Posted by Ivan Khalopik <ik...@gmail.com>.
Just tried your code and everething works as expected. Have you any client
side errors reported by your browser?

On Fri, Oct 5, 2012 at 8:41 AM, Henrik von Schlanbusch <he...@enovate.no>wrote:

> Hi. I have problems understanding multiple submits. I am running T5.3.5.
>
> I have the following tml:
>
> <t:zone t:id="singleUserRegistrationFormZone"
> id="singleUserRegistrationFormZone">
>         <t:form t:id="singleUserRegistrationForm"
> zone="singleUserRegistrationFormZone">
>                 <t:submit t:id="setSelectedGroup"/>
>                 <t:submit t:id="sendUserRegistration"
> value="${signupLabel}"/>
>         </t:form>
> </zone>
>
>
> And javacode:
>
>
>
>  @Component
>     private Submit setSelectedGroup;
>
>     @Component
>     private Submit sendUserRegistration;
>
>     public void onSelectedFromSetSelectedGroup() {
>         getLog().info("SELECT GROUP: " + selectedGroup);
>     }
>
>     public void onSelectedFromSendUserRegistration() {
>         getLog().info("SELECT Userre: " + selectedGroup);
>     }
>
>     public Object onSuccessFromSingleUserRegistrationForm() {
>         getLog().info("SUCCESS - SINGLE USER REGISTRATION");
>
>     }
>
> From what I understand of the documentation, when clicking on the
> setSelectedGroup,
> the method "onSelectedFromSetSelectedGroup" should be run first, then the
> onSuccessFromSingleUserRegistrationForm(). When observing from my debugger,
> the "onSelectedFromSetSelectedGroup" is never run. The click on the
> setSelectedGroup will consequently only run the success method of the
> form. So my question is: have I misunderstood the documentation, is it
> not possible to run different methods on the serverside from different
> buttons on the client? And if it is possible, can somebody help me in
> spotting where I have done something wrong?
>
> -Henrik
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
BR
Ivan