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
Is php object oriented?
What happens when submit button is clicked?
What does a special set of tags do in php?
Is false empty php?
Explain what are some new features introduced in php7?
What is the timeout period on session values?
How does session work in php?
What is Mcrypt used for?
What is the difference between get and post method in php?
What is the content of /etc directory?
Which is useful for method overloading?
What's the difference between accessing a class method via -> and via ::?
What does $globals means?
Tell me how to set a page as a home page in a php based site?
How to remove white spaces from the beginning and/or the end of a string in php?