We help IT Professionals succeed at work.
Get Started

Multiple Submit Buttons

APD Toronto
APD Toronto asked
on
256 Views
Last Modified: 2015-04-20
Hi Experts,

How is it possible for me to have multiple Submit buttons on a form that act slightly differently?

For example,  1 submit button will have a value of "save", and that button will be clicked when the user wants the info. Here, I would like to trigger a JS function checkRequired() that would check if all mandatory fields are filled in, if they aren't, it will return false. To do this I have my checkRequired() under my form onSubmit.

The second submit button I need to have will be called "Upgrade Package". Here I need to get something from the database, so I need to post the already entered info by the user, but I don't want to checkRequired() because most likely not all information will be entered. The upgrade, as I mentioned need to get some info from the db, and load a different page.

As well, both submits need to go to a different URL, for example, index.php?action=save and index.php?action=upgrade

An alternate way I was thinking if it is possible to make both submit buttons as regular buttons, and have a function trigger the actual submission/posting.

Thank you
Comment
Watch Question
Principal Data Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE