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
Tell me what is the actually used php version?
How can we pass the variable through the navigation between the pages?
Tell me what are the correct and the most two common way to start and finish a php block of code?
How can you submit a form without a submit button?
What's the difference between __sleep and __wakeup?
Write a query to find the 2nd highest salary of an employee from the employee table?
What is mysql_fetch_object?
Tell me how to retrieve a cookie value?
What is a closure in php?
What are the final class and final method?
How do I start a php session?
What is abstraction php?
What is the purpose of the '.myi' file extension? What do thes file contain?
What are the different types of statements that are present in php?
What is php sequence?