submit problam

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

submit problam

Post 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]
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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">
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

thanx

Post by shiranwas »

hi,

THANK YOU. its working as the way i want

shiran
Post Reply