HighDots Forums  

newbie onreset and onsubmit

Javascript JavaScript language (comp.lang.javascript)


Discuss newbie onreset and onsubmit in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bbxrider
 
Posts: n/a

Default newbie onreset and onsubmit - 07-25-2003 , 07:44 PM






neither is working but am concentrating now just for onreset
here is the code for both:

<FORM onSubmit="
this.firstname.optional=true;
this.lastname.optional=true;
this.addr1.optional=true;
this.city.optional=true;
this.state.optional=true;
this.zip.min=0;
this.zip.max=99999;
this.homephone.optional=true;
this.email.optional=true;
return verify(this);
"
onreset =
return confirm("do you really want to erase everything entered and start
over from scratch?");

Quote:
then the code for the reset button
<input type="SUBMIT" value="Submit Volunteer Information"> <input
type="RESET" value="Start Over">

basically the web page just flashes when i click the reset and submit
buttons
once i get the basic reset going then i will finish up on the verifications
am i missing some really basic coding here??




Reply With Quote
  #2  
Old   
Lee
 
Posts: n/a

Default Re: newbie onreset and onsubmit - 07-25-2003 , 09:13 PM






"bbxrider" said:
Quote:
neither is working but am concentrating now just for onreset
here is the code for both:

FORM onSubmit="
this.firstname.optional=true;
this.lastname.optional=true;
this.addr1.optional=true;
this.city.optional=true;
this.state.optional=true;
this.zip.min=0;
this.zip.max=99999;
this.homephone.optional=true;
this.email.optional=true;
return verify(this);
"
onreset =
return confirm("do you really want to erase everything entered and start
over from scratch?");



then the code for the reset button
input type="SUBMIT" value="Submit Volunteer Information"> <input
type="RESET" value="Start Over"

basically the web page just flashes when i click the reset and submit
buttons
once i get the basic reset going then i will finish up on the verifications
am i missing some really basic coding here??
onreset = "return confirm('do you really want to erase everything entered and
start over from scratch?');"

The value of the onreset attribute has to be in quotes.
The argument to confirm should be all on one line.



Reply With Quote
  #3  
Old   
bbxrider
 
Posts: n/a

Default Re: newbie onreset and onsubmit - 07-26-2003 , 08:53 PM



thanks evertjan, for the clarfiication,
but why did you enclose your example within the <div
and change it to onclick.....
"Evertjan." <exjxw.hannivoort (AT) interxnl (DOT) net> wrote

Quote:
Lee wrote on 26 jul 2003 in comp.lang.javascript:
onreset = "return confirm('do you really want to erase everything
entered and start over from scratch?');"

The value of the onreset attribute has to be in quotes.
The argument to confirm should be all on one line.

bit OT:

It is quite possible to have the source on more lines:

div
onclick = "alert('Result is: '+
confirm('Do you understand that'+
'not all this text\nhas to be on one line ?'));"
click me</div


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Reply With Quote
  #4  
Old   
bbxrider
 
Posts: n/a

Default Re: newbie onreset and onsubmit - 07-27-2003 , 01:20 PM



ok thanks again
any ideas on making onsubmit work?

1. does onsubmit within the form tags work at all? this doesn't work and
i've seen postings that it will never work
<FORM method="Post" action="phsVolunteerData.asp"
onsubmit="
alert('just testing to get onsubmit code to get invoked');
">

2. i am now trying this but does not work either
<input type="button" value="submit" onClick="verify(this.form)">
<script
verify(f)
}
alert('just testing to get onsubmit code to get invoked');
...........lots of verification code
return;
}

does it matter where the javascript code is placed within the html code??

"Evertjan." <exjxw.hannivoort (AT) interxnl (DOT) net> wrote

Quote:
bbxrider wrote on 27 jul 2003 in comp.lang.javascript:
thanks evertjan, for the clarfiication,
but why did you enclose your example within the <div
and change it to onclick.....

To make it easily testable in test.html.

This [my answer] was about the multilineability syntax of a string,
not about form reset buttons.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Reply With Quote
  #5  
Old   
Evertjan.
 
Posts: n/a

Default Re: newbie onreset and onsubmit - 07-27-2003 , 02:17 PM



bbxrider wrote on 27 jul 2003 in comp.lang.javascript:
Quote:
any ideas on making onsubmit work?

1. does onsubmit within the form tags work at all? this doesn't work
and i've seen postings that it will never work
FORM method="Post" action="phsVolunteerData.asp"
onsubmit="
alert('just testing to get onsubmit code to get invoked');
"

2. i am now trying this but does not work either
input type="button" value="submit" onClick="verify(this.form)"
script
verify(f)
}
wrong one, should be {

Quote:
alert('just testing to get onsubmit code to get invoked');
..........lots of verification code
return;
}

does it matter where the javascript code is placed within the html
code??
This should work:

<FORM method="Post" action="phsVolunteerData.asp"
onsubmit="alert('testing onsubmit');return true;">

and this:

<FORM method="Post" action="phsVolunteerData.asp"
onsubmit="alert('testing onsubmit');this.submit();return false;">

and this:

<form ....
<input type="button" value="submit"
onClick="return verify(this.form);">

verify(f) {
alert('just testing');
if (verifiedOK)f.submit();
return false;
}

and this:

<form ....
<input type="button" value="submit"
onClick="return verify(this.form);">

verify(f) {
alert('just testing');
return (verifiedOK);
}



not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


Reply With Quote
  #6  
Old   
bbxrider
 
Posts: n/a

Default Re: newbie onreset and onsubmit - 07-27-2003 , 05:51 PM



wow super reply, many thanks and btw this a volunteer project for a
non-profit
animal shelter, so thanks not only from me but lots of dogs, cats, birds,
turtles.................
so one example worked, none of the examples that call the verify() function
work
which is critical

this worked to at least display the alert
<FORM method="Post" action="phsVolunteerData.asp"
onsubmit="alert('testing onsubmit');return true;">
onreset= "
return confirm('do you really want to erase ' +
'everything entered and start over from scratch?');"
Quote:
this did not work
<FORM
onsubmit="
alert('this alert from the onsubmit in the '+
'form tag');
return verify(this);"
onreset= "
return confirm('do you really want to erase ' +
'everything entered and start over from scratch?');"
Quote:
this is same function verify() for the above examples
function verify(f) {
// verifies all the fields set for verification and messages
var msg = "form length = " + f.length + " fields";
alert('alert msg now coming from the called verify() function');
<!-- next step below if alert ever works -->
<!-- return confirm('return true=ok or false=cancel'); -->
return false;
)

none of the <input type="button" options worked with the different verify
code, not even the alert came up
verify(f) {
alert('just testing');
return false; <!-- or return true as well -->
}


"Evertjan." <exjxw.hannivoort (AT) interxnl (DOT) net> wrote

Quote:
bbxrider wrote on 27 jul 2003 in comp.lang.javascript:
any ideas on making onsubmit work?

1. does onsubmit within the form tags work at all? this doesn't work
and i've seen postings that it will never work
FORM method="Post" action="phsVolunteerData.asp"
onsubmit="
alert('just testing to get onsubmit code to get invoked');
"

2. i am now trying this but does not work either
input type="button" value="submit" onClick="verify(this.form)"
script
verify(f)
}

wrong one, should be {

alert('just testing to get onsubmit code to get invoked');
..........lots of verification code
return;
}

does it matter where the javascript code is placed within the html
code??

This should work:

FORM method="Post" action="phsVolunteerData.asp"
onsubmit="alert('testing onsubmit');return true;"

and this:

FORM method="Post" action="phsVolunteerData.asp"
onsubmit="alert('testing onsubmit');this.submit();return false;"

and this:

form ....
input type="button" value="submit"
onClick="return verify(this.form);"

verify(f) {
alert('just testing');
if (verifiedOK)f.submit();
return false;
}

and this:

form ....
input type="button" value="submit"
onClick="return verify(this.form);"

verify(f) {
alert('just testing');
return (verifiedOK);
}



not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.