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

Describe PHP error and logging information?

794


What is the different between count() and sizeof() in php?

741


What is input sanitization in php?

760


How to set a page as a home page in a php based site?

728


How many escape sequences are recognized in double-quoted strings?

803


Tell me which function gives us the number of affected entries by a query?

782


Explain about objects in PHP?

784


How to create reusable code in php?

786


Write a program to swap two numbers using php.

789


What is the integer?

831


What is the main difference between require() and include()?

689


What is php compared to html?

747


Is php required for wordpress?

753


What is the difference between null and empty?

798


What is polymorphism in php?

758