Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: How to validate forms in action script????
From: Branden Hall
Date: Sun, 12 Dec 1999 07:39:50 GMT

Okay.... here you roll...

On (Press)
Set Variable: "size" = length(userinput)
Set Variable: "badInput" = false
Set Variable: "loop1" = 1
Loop While (loop1<=size and badInput=false)
Set Variable: "loop2" = 0
Set Variable: "isNumber" = false
Loop While (loop2<=9 and isNumber=false)
If (substring(userinput,loop1,1) eq loop2)
Set Variable: "isNumber" = true
End If
Set Variable: "loop2" = loop2+1
End Loop
If (isNumber=false)
Set Variable: "badInput" = true
End If
Set Variable: "loop1" = loop1+1
End Loop
If (badInput=true)
Trace ("Not all numbers!")
Else
Trace ("All numbers!")
End If
End On

That will take a string, run through it as few times as possible to make
sure its all numbers and then either print to the trace window Not all
numbers! or All numbers!. For your uses just swap out those trace
statements with what you need. Enjoy!

-= Branden J. Hall
-= Multimedia Developer/Instructor
-= Fig Leaf Software

----- Original Message -----
From: Daniel Votino <danielatflashbrothers [dot] com>
To: <flasheratchinwag [dot] com>
Sent: Saturday, December 11, 1999 11:42 PM
Subject: RE: FLASH: How to validate forms in action script????


> Ive spent five hours on this and I just cant find the answer. =(
> Does anyone out there know this one?
>
> Im trying to validate a field in a flash form at the "submit" button.
> The number in the field can be any number, including zero, so long as
> the number contains no commas. (Id really like to rule out all foreign
> symbols but I wont press my luck).
>
> Please note the "Else If (DownPayment)" line in the action script below.
>
> On (Press)
> If (DownPayment eq Chr(44))
> Get URL ("javascript:AlertMsg("Please check to make sure
> the DOWN PAYMENT field contains no symbols or
> commas.")")
> Else . . . . . blah blah {complete computation}
> End If
> End On
>
> The statement above presently works if the first character in the
> DownPayment
> field is the comma (ASCI code "Chr(44)) but not if there are any
> characters
> following it or if it is first preceded by a number or symbol i.e.
> "1,000" or
> ",1000". now, of course I could write a mammoth string, something like
> this . . .
>
> "If (DownPayment eq Chr(44)
> or DownPayment eq 1&Chr(44)
> or DownPayment eq 2&Chr(44)
> or DownPayment eq 3&Chr(44))" yadda yadda
>
> but I could do this all the way through 100 and it would only work for
> 1, 2, 3, 4, etc and not 1,000 2,000 or 3,000 etc. see my delemma?
> There has to be an easier way than inputting every possible error a
> person might input.
>
> Anyway, appreciate any help one can offer. Thanks in advance.
>
> ~daniel
>
>
> flasher is generously supported by...
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Streaming Media WEST '99 Conference & Exhibition
> "The Worlds largest Internet Audio & Video Event"
> December 7 - 9, San Jose Convention Center, California
>
> Reserve your space today at http://www.streamingmedia.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To unsubscribe or change your list settings go to
> http://www.chinwag.com/flasher or email helpatchinwag [dot] com
>
>



flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streaming Media WEST '99 Conference & Exhibition
"The Worlds largest Internet Audio & Video Event"
December 7 - 9, San Jose Convention Center, California

Reserve your space today at http://www.streamingmedia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: How to validate forms in acti, John Croteau

Replies
  RE: FLASH: How to validate forms in acti, Daniel Votino

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]