Is it possible to submit an HTML form (with PHP action) and enable it javascript onsubmit="VerifyFields()?
javascript
onsubmit="VerifyFields()
I'm trying to do it now, but it seems like it will execute a PHP action, not one onsubmit.
onsubmit
Thank you for your help.
The problem was that I put my function VerifyMe()in <head></head>, not in <body></body>.
VerifyMe()
<head></head>
<body></body>
If return false in the onsubmit handler, the form will not be submitted; if you return true, it will.
You must make the VerifyFields function return true or false and call it like this:
onsubmit="return VerifyFields();"
<script type="text/javascript"> function validateForm(){ ... } </script> <form name="contact" action="<?=$_SERVER['PHP_SELF']?>" method="post" onsubmit="return validateForm();"> <label> Foo </label> <input type="text" class="txt_input" name="sender_name" /> ... <input type="image" src="img/send.jpg" id="submitButton" name="submitForm" value="send" /> </form>
I would check the input by passing any fields to the server. I would test it on the client side of javascript and finally send it to the server. You can also call your script.
<input type="text" class="txt_input" name="sender_name" onchange="validateForm();" />
Source: https://habr.com/ru/post/1732445/More articles:How to make Xml comments in VS 2008 work with Intellisense for enumerations? - visual-studio-2008Streaming HTTP Messages Using iPhone? - iphoneЕсть ли способ добавить метод расширения к лямбда? - c#Audio encoding (in AAC) in Silverlight 4 (on the client)? - encodingSpeed up mdb insert - c #Flex 4 динамически изменяет размер родительского контейнера, чтобы содержать детей - flexeach function () and list () - iteratorLastActivityDate Custom Membership List - asp.netWhy does this extension method not work? - c #Learning Haskell: How to Implement My Own Version of the init Function - haskellAll Articles