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
Describe PHP error and logging information?
What is the different between count() and sizeof() in php?
What is input sanitization in php?
How to set a page as a home page in a php based site?
How many escape sequences are recognized in double-quoted strings?
Tell me which function gives us the number of affected entries by a query?
Explain about objects in PHP?
How to create reusable code in php?
Write a program to swap two numbers using php.
What is the integer?
What is the main difference between require() and include()?
What is php compared to html?
Is php required for wordpress?
What is the difference between null and empty?
What is polymorphism in php?