Announcement

Collapse
No announcement yet.

How do I restrict certain characters in an edit field

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I restrict certain characters in an edit field

    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 !"#¤%&/()=?+ The reason being that this is a URL field and only certain characters are allowed.

  • #2
    Re: How do I restrict certain characters in an edit field

    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

    Comment


    • #3
      Re: How do I restrict certain characters in an edit field

      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 ;-)

      Comment


      • #4
        Re: How do I restrict certain characters in an edit field

        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

        Comment


        • #5
          Re: How do I restrict certain characters in an edit field

          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. ?

          Comment


          • #6
            Re: How do I restrict certain characters in an edit field

            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

            Comment


            • #7
              Re: How do I restrict certain characters in an edit field

              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

              Comment


              • #8
                Re: How do I restrict certain characters in an edit field

                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

                Comment

                Working...
                X