Simple JS Validation Question

S

Samuel Shulman

Hi all

I want is to check the value in a certain input control and based on the
value I may want to stop the POST request

Thank you,
Samuel
 
M

Martin Honnen

Samuel said:
I want is to check the value in a certain input control and based on the
value I may want to stop the POST request

<form onsubmit="return validateForm(this);" ...>


function validateForm (form) {
return form.elements.inputName.value != 'whatever';
}

Returning true in the onsubmit handler submits the form, returning false
cancels the submission.
 
S

Samuel Shulman

Thank you


Martin Honnen said:
<form onsubmit="return validateForm(this);" ...>


function validateForm (form) {
return form.elements.inputName.value != 'whatever';
}

Returning true in the onsubmit handler submits the form, returning false
cancels the submission.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top