You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by José Ventura <ve...@cit.com.br> on 2003/04/14 22:00:29 UTC
Submitting a form to different actions
I have a form that I want to send to two different actions, based
on the button the user clicked on (sort of a /update.do or
/insert.do). But in the html:form tag I can only specify one:
html:form action="/update.do"
Is there a way to change the action that is triggered? I thought
of changing the form's action in Javascript; that way, each button
would be a "javascript:goSubmit( 'update' )" or
"javascript:goSubmit( 'insert' )". The goSubmit() function would
look like this:
function goSubmit( type ) {
if ( type1... ) {
document.myform.action = "/insert.do";
} else if ( type2... ) {
document.myform.action = "/update.do";
}
}
Is there a better way to do this?
[]'s
- ventura
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org