Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

how can I make a confirmation before trigger the submit of a buttom?

Hello guys

I have a buttom and I need to make a confirmation before trigger the form submit.

is there any way to do that in the button? If my confirmation is not, It must cancell the submit.

thanks
0
hidrau
Asked:
hidrau
  • 3
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
using :
<input type="button" onclick="if(validate()) this.submit();" value="Submit" />

Open in new window


or :


<input type="submit" onclick="return validate()" value="Submit" />

Open in new window

0
 
Roman GhermanSenior Software EngineerCommented:
return false if you want to cancel the submit:

<input type="submit" onclick="return false;" value="Submit" />

Open in new window

0
 
hidrauAuthor Commented:
thanks very much
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
leakim971PluritechnicianCommented:
function validate {
   //validate
   // if a test fail return false
   //
   // finally :
   return true; // by default return true to submit the form
}

Open in new window

0
 
leakim971PluritechnicianCommented:
You're welcome! Thanks for the points!
0
 
hidrauAuthor Commented:
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now