hi there,
i have a problem resetting my form with javascript. I have a registration form that when submitted, the action is performed in an iframe so that the browser does not have to load another page. After form validation, i want the php script in the iframe to clear all fields of the form in the parent document. i have tried all ways like:
$insert_sql = mysql_query("INSERT INTO ...... ");
if($insert_sql){
?>
<script>
alert("Query Successful");
parent.document.forms[0].reset();
</script>
<?php
}else{
?>
<script>
alert("<?php mysql_error($conn); ?>");
</script>
<?php
}
i have tried everything from giving the form an ID and using
document.getElementById('form').reset();
But i still cannot reset the form. What can i do. Please help. Thanks alot.