You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by riccaruf <ri...@mapsengineering.com> on 2008/01/08 16:44:26 UTC

T5 javascript form submit toolbar

Hi everybody!

I have a simple question (hope) about T5 and I don't know what I'm doing
wrong :-(
I'm trying to build a sort of command toolbar for my application in a
component that
all pages of the application have to add to theirself.

This toolbar let the user submit with different logical event handler method
the page form, 
passing a parameter to retrieve which button has been pressed by the user. 

In short I've got something like that

function submitForm(formName)
{	var d = $(formName);
	d.submit();
}

in the toolbar component(button.tml) I've got something like 

!a t:type="actionlink" t:id="appbuton" onclick="submitForm('${formId}');" />

button.java retrieve the value for formId and buttonImg formId='formTest' in
the example

In sample.tml a form like that

<form t:type="Form" t:id="testForm" >
     	<t:errors/>
     	<t:label t:for="name"/> 
     	<input t:type="textfield" t:id="name" t:value="formBean.name"/><br/>
      	<t:label t:for="number"/> 
      	<input t:type="textfield" t:id="number"
t:value="formBean.number"/><br/>
      	<input type="submit" id="submitbtn"/>
</form> 

and in sample.java the event handler method

@InjectPage(value="sampletest")
	private Object sampleTest;
	
@OnEvent(component="testForm",value="submit")
private Object onSubmit(){
	logger.info("### on submit return page ...");
	return sampleTest;
}

Naturally I've already tried to submit using its button and everything works
fine,
and T5 create the redirect url to my sampleTest page so the browser can send
its render request
for that page.
Otherwise using the button link of the toolbar I've noticed that the submit
event was fired
but after a redirection to the same page(???) so it seems there are two
different events,
a event handler with return value void (redirect to the same page

Have you got any ideas?Any suggestion for a different approach? I've read
the interesting post
on using an Ajax request to transfer data, but I'd like to understand why T5
do that...and I don't find
anything else about something similar :(

Thanks in advance.

-Rick.
-- 
View this message in context: http://www.nabble.com/T5-javascript-form-submit-toolbar-tp14692144p14692144.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