Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: HELP!! Can't get onClick to function properly(?)


Message #1 by "Melinda Savoy" <msavoy@h...> on Tue, 26 Feb 2002 19:28:22
Ummm, no.

George L Smyth, Webmaster
U.S. Naval Academy Alumni Association

 -----Original Message-----
From: 	Johnson, Israel [mailto:IJohnson@R...] 
Sent:	Tuesday, February 26, 2002 3:28 PM
To:	javascript
Subject:	[javascript] RE: HELP!!  Can't get onClick to function
proper ly(?-     )

George....Do you know anything about BizTalk Server?

-----Original Message-----
From: George Smyth [mailto:george.smyth@U...]
Sent: Tuesday, February 26, 2002 3:17 PM
To: javascript
Subject: [javascript] RE: HELP!! Can't get onClick to function proper
ly(?- )


Right, that's what my answer does.  If your function returns false, you need
to return that value to the browser.  By including return in your onClick
statement (onclick="return checkform()") you are doing just that.

Cheers -

George L Smyth, Webmaster
U.S. Naval Academy Alumni Association

 -----Original Message-----
From: 	Melinda Savoy [mailto:msavoy@h...] 
Sent:	Tuesday, February 26, 2002 2:48 PM
To:	javascript
Subject:	[javascript] RE: HELP!!  Can't get onClick to function
properly(?-     )

George,

Thank you very much.  I am only looking to cancel the submission button 
if the criteria is met.  Otherwise I do not, if that makes any sense.

Thanks again!!!

> If you are looking to cancel the submission, you need to have your code 
as:
> 
> onclick="return checkform()"
> 
> Cheers -
> 
> George L Smyth, Webmaster
> U.S. Naval Academy Alumni Association
> 
>  -----Original Message-----
> From: 	Melinda Savoy [mailto:msavoy@h...] 
> Sent:	Tuesday, February 26, 2002 2:28 PM
> To:	javascript
> Subject:	[javascript] HELP!!  Can't get onClick to function
> properly(?)
> 
> I am in need of some help please.  I've got the following javascript 
code 
> that when launched does not appear to be acknowledging the "return 
false;"
> code.  Here is the javascript code:
> <script LANGUAGE="Javascript">
> function checkform()
> <!--
> {
> // Return false if a Medical School is not selected.
> if 
> 
((document.thr_physician_referral_information_profile_pg3.medclschcode.val
> ue == "") && 
> 
(document.thr_physician_referral_information_profile_pg3.altmedclschname.v
> alue == ""))
> {
> alert("There must be a either a MEDICAL SCHOOL selected from drop-down 
> list OR written in MEDICAL SCHOOL text box.");
> 
document.thr_physician_referral_information_profile_pg3.medclschcode.focus
> ();
> return false;
> }
> 
> if 
> 
((document.thr_physician_referral_information_profile_pg3.medclschcode.val
> ue !== "") && 
> 
(document.thr_physician_referral_information_profile_pg3.altmedclschname.v
> alue !== ""))
> {
> alert("Either select a MEDICAL SCHOOL from drop-down OR write in your 
> MEDICAL SCHOOL in text box. NOT BOTH.");
> 
document.thr_physician_referral_information_profile_pg3.medclschcode.focus
> ();
> return false;
> }
> 
> // Return false if characters are not digits '0-9'.
> for (var i = 0; i < 
> 
document.thr_physician_referral_information_profile_pg3.yrsinpractc.value.
> length; i++)
> {
> var ch = 
> 
document.thr_physician_referral_information_profile_pg3.yrsinpractc.value.
> substring(i, i + 1);
> if (ch < "0" || "9" < ch)
> {
> alert("The YEARS IN PRACTICE field only accepts digits '0-9'. Please re-
> enter your YEARS IN PRACTICE.");
> 
document.thr_physician_referral_information_profile_pg3.yrsinpractc.focus
> ();
> return false;
> }
> }	
> }
> --></script>
> 
> Here is the onClick event handler location:
> 
> <tr>
> <td width="10">&nbsp;</td>
> <td align="center" valign="top" colspan="5">
> <input type="hidden" name="y" value="<%=practcstartyr%>">
> <input type="submit" name="submit" value="CONTINUE" onclick="checkform
> ()"><br><br></td>
> </tr>
> 
> What am I doing wrong?  Any help would be appreciated.  Thanks!!!
$subst('Email.Unsub').




  Return to Index