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


Please Help Members By Posting Answers For Below Questions

How do I run php?

522


What is meant by session in php?

496


When a conditional statement is ended with an endif?

511


Tell me what is the actually used php version?

548


What do you mean by having php as whitespace insensitive?

497






Why delimiter is used in mysql?

543


What type of language is php?

511


Which functions are used to count the total number of array elements in php?

530


Explain the difference between unlink() and unset()?

524


Which is the best web server?

524


How to delete file in php?

518


Tell me what is the use of "ksort" in php?

547


What is difference between php and html?

482


How to delete cookie files on your computer?

542


What is cookie in php with example?

519