here's what I would do...

1) replace the type='submit' for the submit button with type='button'
2) add a function call to the button  - onclick='javascript return
someFunction();'
3) in the function someFunction(), do your error trapping.  if a condition
is met, do a form.submit(); else, alert the user then do a return false;



----- Original Message -----
From: "Hinojosa, Robert A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 17, 2001 3:09 PM
Subject: RE: How to abort a program in JS


> Try this.  Shot in the dark.
>
> <script>
> function savedata()
> {
>
mytopic=document.header.topic_list.options[document.header.topic_list.select
> edIndex].value;
>
> if(mytopic=='FC'){
> alert(mytopic)
> alert("Please choose topic code.");
>   }
> else
> return true;
> }
> </script>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 17, 2001 2:39 PM
> To: [EMAIL PROTECTED]
> Subject: How to abort a program in JS
>
>
> Aprogram checks a variable's value and has to abort the process if the
> value is ''FC. The same page should be displayed to let a user to change
> the value. How to do it? My program continues excution afte an alert box
is
> closed
>
> <script>
> function savedata()
> {
> <cfoutput>
>
mytopic=document.header.topic_list.options[document.header.topic_list.select
> edIndex].value;</cfoutput>
> if(mytopic=='FC')
> alert(mytopic)
> alert("Please choose topic code.");
> }
> </script>
>
>
>
> (Embedded image moved to file: pic32591.pcx)
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to