6 Replies Latest reply on Jun 28, 2012 8:06 AM by Stephen41

    Validate my field, not allow "/"

    Stephen41

      Hi,

       

      I for some reason can't figure out how to validate a field so that after text is entered, the field is searched to make sure there is no "/" in the field. Help!

       

      Thanks.

        • 1. Re: Validate my field, not allow "/"
          ariley

          You can do validation in 2 places: 

           

          On the field itself. You can use the filter function e.g. to get rid of things or substitute to replace them.

          Or you can initiate a script with a trigger and then see what's in the field (in a variable) and then make sure your data is clean.

           

          Hope this helps.

           

          agnes b. riley . filemaker and web development

          FileMaker Business Alliance . FileMaker Technical Network

          www.zerobluetech.com (http://www.zerobluetech.com)

           

           

          T 201-299-6223 (NJ) .

          212-842-8830 (NY)

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

          .

          917-660-7221 (C)

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

          FileMaker Certified in 10 and 11

          people + products + events + todos + invoices + documents = productivity

          • 2. Re: Validate my field, not allow "/"
            Stephen Huston

            A. Riley's cleanup function or similar content replacement functions are enabled by setting the Field Definitions area to auto-enter by calculation, using various Case, Substitute, and Fileter operators on the fields own content, so it will update itself when it is edited and there is a commit or field-exit. This does not require script triggers when done at the field definition level.

             

            This also bypasses the need for these things as validation tests; just set them to self-clean on entry.

            • 3. Re: Validate my field, not allow "/"
              Stephen41

              I guess I'm more looking for the actual calculation itself.  I know where to put it, I just can't figure out what to create.

              • 4. Re: Validate my field, not allow "/"
                keywords

                Two thoughts:

                 

                1.     If you want the user to be prompted in some way, use a script trigger on field modify, eg: 

                 

                If [ PatternCount ( YourFieldName ; "/" ) ]

                Show Custom Dialog [ Title: "OOPS!"; Message: "You cannot use a \"/\" in this field"; Buttons: “OK” ]

                Go to Field [ YourFieldName ]

                End If

                 

                Of course, the script can also be set to do other things besides return the user to the field; the world is your oyster!

                 

                2.     If you want to simply not allow the / character, then you can set the field to auto replace itself using:  Substitute ( self ; "/" ; "" ).  This will simply delete the /; if you want it replaced with something (a space perhaps?) then you only need to specify that in the third parameter.

                 

                Hope that's of some help.

                • 5. Re: Validate my field, not allow "/"
                  Vaughan

                  Stephen Huston wrote:

                   

                  A. Riley's cleanup function or similar content replacement functions are enabled by setting the Field Definitions area to auto-enter by calculation, using various Case, Substitute, and Fileter operators on the fields own content, so it will update itself when it is edited and there is a commit or field-exit. This does not require script triggers when done at the field definition level.

                   

                  This also bypasses the need for these things as validation tests; just set them to self-clean on entry.

                   

                  Data can be imported that does not run the auto-enter functions. So if there is a real need to NEVER have the / character then also use validation, this will prevent the record from being imported.

                  • 6. Re: Validate my field, not allow "/"
                    Stephen41

                    Thank you!