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
How do I run php?
What is meant by session in php?
When a conditional statement is ended with an endif?
Tell me what is the actually used php version?
What do you mean by having php as whitespace insensitive?
Why delimiter is used in mysql?
What type of language is php?
Which functions are used to count the total number of array elements in php?
Explain the difference between unlink() and unset()?
Which is the best web server?
How to delete file in php?
Tell me what is the use of "ksort" in php?
What is difference between php and html?
How to delete cookie files on your computer?
What is cookie in php with example?