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 are the 3 types of sessions?
In PHP, fgets() is used to read a file one line at a time. State Whether True or False?
Describe session in php.
Where are php configuration settings stored?
How can you upload a file using php?
What happens if an expected input field was not submitted?
How do I display php errors?
Which is not a php magic constant?
How the values are ordered in an array?
Tell me how would you declare a function that receives one parameter name hello?
How is it possible to set an infinite execution time for php script?
What are the uses of implode() function?
Do you know when sessions ends?
What is the difference between $argv and $argc? Give example?
What is fetch array in php?