Posts tagged: multiple actions

Multiple actions on one form

By , November 19, 2009 10:46 pm

By using form tag we can define a action where we can submit the data and proceed further.

Now there are multiple submit button on the form and each required different action. So how to do that?

I found one easy solution for the this.


<form action="ACTION" name="formName"  id="formName">

<input type="text">

.....

<input type="submit" value="Submit">

<input type="button" value="Next" onclick="next()">

<input type="button" value="Previous" onclick="previous()">

</form>

function next(){

document.formName.action="Next Action";

document.formName.submit();

}

function previous(){

document.formName.action="Previous Action";

document.formName.submit();

}

So this way we can define multiple actions on the same page.

Panorama Theme by Themocracy