Irfan,
Thanks for the response.
My usage is based on an algorithm I use in VBS. The submit button goes to
Validate() before the page processes frmForm_OnSubmit.
'-------------------------------------------------------------------------
Function frmForm_OnSubmit()
If form.txtSubmitForm.value = "No" Then
frmForm_OnSubmit = FALSE
Exit Function
End If
frmForm_OnSubmit = TRUE
End Function
'-------------------------------------------------------------------------
Function Validation ()
Do stuff to determine
if I want to submit the form (assign txtSubmitForm = "Yes"), or
if I want to return the user to the page without submitting the form
(assign txtSubmitForm = "No")
such as for validating that an email field txtYourEmailAddress.value
that I want filled-in is not blank
End Function
'-------------------------------------------------------------------------
As I just started working with JavaScript, I don't know if this algorithm
will work "as is" simply changing syntax, or whether a different approach is
required entirely.
Any opinion?
Also, does Javascript have a SUB procedure similar to VBS, or just the
FUNCTION procedure that can optionally return no arguments (which I guess
would effectively be a SUB)?
TIA,
Far
-----Original Message-----
From: Irfan Baig [mailto:[EMAIL PROTECTED]
Sent: Friday, December 31, 2004 8:22 PM
To: [email protected]
Subject: Re: [ASP] Javascript Questions
I would rather do it this way:
<form name="" action="" onSubmit="return Validation();">
-----
-----
-----
</form>
----- Original Message -----
From: "The Professional Network"
To: " ASP Developers"
Subject: [ASP] Javascript Questions
Date: Fri, 31 Dec 2004 18:49:21 -0500
I started to convert a simple VBS validation script to JavaScript, when I
came across a syntax problem that has me buffaloed. Consider the following
page:
<html>
<head>
<title>
Example_01
</title>
</head>
<body>
<form
name="frmForm"
action="Example_01_Redirect.asp"
method="post"
>
<Input
type="button"
name="cmdSubmit"
value="Send Request"
OnClick="Validation()"
>
<br>
<br>
City
<br>
<input
type="text"
size="15"
name="txtCity"
value=""
>
<br>
<br>
The Local Weather
<br>
<textarea
name="txtWeather"
rows="5"
cols="50"
value=""
></textarea>
<br>
<br>
Test 15
</form><!-- frmForm -->
</body>
</html>
<script
language="javascript"
>
function Validation()
{
strA = "Detroit"
alert (strCity)
if (strCity = "Atlanta") { alert ("Atlanta") }
else { alert ("Not Atlanta") }
}
</script>
Nothing fancy, nothing complex. Just a little example to see how the syntax
works. As a test, I made a hard assignment for strCity, making it =
"Detroit". On clicking the button, the first alert statement shows "
Detroit", which obviously is correct. The second alert, in the IF
statement, shows the city as "Atlanta", when I was expecting "Not Atlanta".
Obviously, the problem is in the condition test, (strCity = "Atlanta"), but
I can't see it. What on earth am I doing wrong?
Far Farley
www.TheAccessWizard.com <http://www.theaccesswizard.com/>
[Non-text portions of this message have been removed]
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [email protected]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [email protected]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [email protected]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/