Page 1 of 1

submit problam

Posted: Thu Aug 03, 2006 2:22 am
by shiranwas
Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I have a HTML form with 2 submit buttons one is for clear
 values in text controls using javascript functiion
and the other one to open the PHP page.


when i click the clear button it opens the php page 
i have called the clear function  onClick event of the cleat button, but the button type is submit


this is the clear function
[syntax="javascript"]
function clearAll(){
var texts=document.getElementsByTagName('input')
for (var i_tem = 0; i_tem < texts.length; i_tem++)
if (texts[i_tem].type=='text')
texts[i_tem].value=''
}

</SCRIPT> 

THIS IS THE html coding

Code: Select all

<form method="POST" action="complaintrdata.php">

<input type="submit" name="cmdOK" value="OK"   >      
  <input type="submit" name="cmdClear" value="Clear" onClick="clearAll();">

</form>

what is the proble in this code pls help me

thanks

shiran


Pimptastic | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Aug 03, 2006 2:24 am
by s.dot
Your clear button doesn't need to be a submit button. It can simply just be a button.

Code: Select all

<input type="button" value="clear" onClick="yourclearingfunction">

thanx

Posted: Thu Aug 03, 2006 2:28 am
by shiranwas
hi,

THANK YOU. its working as the way i want

shiran