View Full Version : How do I restrict certain characters in an edit field
tomarppe
02-12-2002, 03:19 PM
I have done a warning screen that i would like to appear if the user adds characters that are not allowed. How do I accomplish that?
the field should not be empty which was easy with the screen condition of
(%MyField% = "") but how to restrict input of characters like !"#¤%&/()=?+ http://www.indigorose.com/ubb/images/icons/crazy.gif The reason being that this is a URL field and only certain characters are allowed.
Darryl
02-12-2002, 03:37 PM
I believe this is possible. Let's say that you are using an Edit Box screen. You can then store the result of the edit boxes in a variable.
Then on the After tab of that screen you would check for the existence of each of the illegal characters that you wish to include. You can accomplish this with one of the string actions.
If one of those characters is found, you could display a message dialog and then set the built-in variable %PreventNextPage% to TRUE. This will prohibit the install from going to the next screen until the user enters a valid string. It will simply display the current screen again.
Hope this helps.
------------------
Sincerely,
Darryl Hnatiuk
Indigo Rose Corporation
tomarppe
02-12-2002, 04:11 PM
How should i compare the illegal characters with the string entered? and Which of the string action should i use? (get delimited string?
Do i need to add one string action for each forbidden character or can it be commadelimited?
Many Questions sorry ;-)
Darryl
02-12-2002, 04:30 PM
I'm sure that there are many other ways, although you could use a Find String action and use the Edit box string in the "Search In" field. If the string was not found it returns a value of -1. I believe that you will need to go through all of the characters separately no matter what you do, although I could be missing an option.
In psuedo code it would look something like:
Find String (specific character - store the result in a variable such as %Result%.
If %Result% <> -1
Display a dialog message
Assign Value %PreventNextPage% = TRUE
End If
Something like that.
------------------
Sincerely,
Darryl Hnatiuk
Indigo Rose Corporation
tomarppe
02-12-2002, 04:59 PM
HI Darryl,
Thanks for your swift responses, i did like you suggested, but It still accepts characters that I have defined, are there any characters that you are not allowed to search for in SF like Euro symbol, paragraph etc. ?
tomarppe
02-12-2002, 05:09 PM
a little update....
It seems that only certain characters work I tested with ! " # where only # was detected should the characters ascii code be used instead or is it possible?
Basically I would like to forbidd all characters except A-Z and 0-9 underscore and hyphen.
Cheers
Tom
tomarppe
02-12-2002, 05:22 PM
HI Again Daryl,
Sorry it was my screw up you just had to put the IF statement inbetween all the different find strings and now everything works like a charm, I must say that geeezz you guys are fast with your answers, now i finaally can get some sleep. It looks like there is nothing you can't do with SF 6.0.
Ystävällisin terveisin (Thats Regards in Finnish)
Toma
Darryl
02-13-2002, 10:49 AM
I'm glad everything worked out for you in the end. I didn't get a chance to respond until now. I like the power and flexibility of SF6 as well.
------------------
Sincerely,
Darryl Hnatiuk
Indigo Rose Corporation
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.