Infopath validation - simple Q - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Infopath validation - simple Q

Last post 11-05-2021 10:52 AM by Hilary Stoupa. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-04-2021 02:10 PM

    Infopath validation - simple Q

    I am trying to do a basic validation in Infopath for a field that can only be a pattern of 5 or 6 numbers. I understand how to do the Data Entry Pattern validations, and 5 digits would be \d\d\d\d\d.

    What I am having trouble with is the option of a sixth character. It may be there, it may not. Both are acceptable. If I use \d\d\d\d\d? it accepts 5 numbers but gives validation error on 6. The "special characters" lists "?" as "0 or 1" but it doesn't seem to work.

    Is this option broken? Is there something I am missing?
  • 11-04-2021 02:33 PM In reply to

    Re: Infopath validation - simple Q

  • 11-04-2021 05:38 PM In reply to

    Re: Infopath validation - simple Q

    Dang - it works great for me too! I wasn't even aware that was a valid way to type the validation formula (and apparently was using the wrong search terms since I never came across the article you cited).

    As always Hilary you are awesome and I thank you for your help!
  • 11-05-2021 10:36 AM In reply to

    Re: Infopath validation - simple Q

    Also, for anyone else that reads this: I figured out what my error was with the previous format. The "zero or one," "zero or more" and "one or more" are modifiers, which must be added after the character pattern identifier.

    For example, I was also trying to figure out how to require 4 numbers, with the option (not required) of an alpha afterwards. The proper way to enter this would be \d\d\d\d\p{L}?, where \d\d\d\d requires four numbers, \p{L} is one letter, but the ? is a modifier, meaning it will accept 0 or 1 instances of the letter.

    In my first query the (other) way to do it would have been \d\d\d\d\d\d?, where the ? modifies the last number requirement, saying 0 or 1 instance is OK. in others words, 5 or 6 numbers would be accepted.
  • 11-05-2021 10:52 AM In reply to

    Re: Infopath validation - simple Q

    Awesome - thanks for adding these details! :)
    Hilary Stoupa

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.