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
Why do we need abstract class in php?
Echo is used to Display message on screen. Which is used with echo to not output the trailing newline?
How do I expire a php session after 30 minutes?
What are the common uses of php?
What is the use of htmlspecialchars in php?
How to turn on the session support in php?
Is laravel frontend or backend?
Explain the difference between mysql_connect and mysql_pconnect?
Tell me how can we define a variable accessible in functions of a php script?
Which character is used to match exactly one character?
How to execute a php script from the command line?
How to find the length of a string?
How to read and display a HTML source from the website url?
Tell me what is the definition of a session?
What is parent __construct ();?