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.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Webnews
  • Digg
  • del.icio.us
  • Reddit
  • Bloglines
  • LinkedIn
  • YahooMyWeb
  • Facebook
  • Google Bookmarks
  • Mixx
  • MySpace
  • Technorati
  • TwitThis

One Response to “Multiple actions on one form”

  1. blue buffalo cat food…

    [...] while web sites we link to listed here are entirely unrelated to ours, we feel they are well worth a read, so have a look [...]…

Leave a Reply

*

Panorama Theme by Themocracy