Jump to content

clear form on Submit


ilikephp

Recommended Posts

have u tried onunload

 

<head>

function clearform()

{

  document.getElementById("textfield1").value="";

}

 

</head>

<body onunload=clearform()>

<form name="form1" method="post" action="form2.php">

<input type="text" id="textfield1" name="textfield1">

<input type="submit" value="submit">

</form>

</body>

 

 

not yet tested but

There's no such thing as a PHP form. Forms are HTML. But ignoring that, something like this should work (you will have to play with it a bit):

 

<form id="my_form" action="/" method="post">
<input type="text" id="my_field" name="something" />
</form>

 

document.getElementById("my_from").onSubmit = function()
{
  document.getElementById("my_field").value("");
}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.