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

What is different between software and app

1231


What is global array in php?

575


Explain difference between urlencode and urldecode?

560


What is composer install?

595


How we get browser details of clients machine?

520






Explain how you can update memcached when you make changes to php?

564


What is the difference between $argv and $argc? Give example?

512


What is the difference between include and require?

530


Explain what are psrs? Choose 1 and briefly describe it?

513


Which will start a session?

581


Explain the types of string comparision function in PHP

516


What is php static function?

540


Is age a variable in research?

490


What is session in php why it is use?

492


What is query string php?

540