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
Why does php need server?
Explain what is the difference between mysql_fetch_array() and mysql_fetch_assoc()?
Does php support multiple inheritance?
What is cURL in PHP?
What is a composer in PHP?
Explain how you can update memcached when you make changes to php?
How break and continue while loop in php?
What is properties of class?
What is form action php?
How to create a text file in PHP?
what does this symbol mean in php?
What is the use of mysql_real_escape_string() function?
Explain different sorting function in php?
Do you know what is the use of the function 'imagetypes()'?
What is a simple php method to make a cross domain data request?