How can we submit a form without a submit buttom?
Answer Posted / ram gopal verma
<script type="text/javascript">
function validateAndSubmit()
{
if(document.getElementById('user_id').value=='') {
alert('Please enter user id');
document.getElementById('user_id').focus();
}
else
if(document.getElementById('pass').value=='')
{
alert('Please enter password');
document.getElementById('pass').focus();
}else
{
document.form1.submit();
}
}
</script>
<form id="form1" name="form1" method="post" action="action.php" onsubmit="return validate()">
<input type="text" name="user_id" id="user_id" />
<input type="password" name="pass" id="pass" />
<a href="javascript:validateAndSubmit();">Submit Me..</a>
</form>
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is different between software and app
What is global array in php?
Explain difference between urlencode and urldecode?
What is composer install?
How we get browser details of clients machine?
Explain how you can update memcached when you make changes to php?
What is the difference between $argv and $argc? Give example?
What is the difference between include and require?
Explain what are psrs? Choose 1 and briefly describe it?
Which will start a session?
Explain the types of string comparision function in PHP
What is php static function?
Is age a variable in research?
What is session in php why it is use?
What is query string php?