Data validation error for field with custom pattern validation - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Data validation error for field with custom pattern validation

Last post 02-13-2020 02:59 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-13-2020 10:20 AM

    Data validation error for field with custom pattern validation

    Hi all, I'm having an issue with having an InfoPath Form where I have created a data validation rule where the text field will give a validation error unless it does not match one of the patterns below:

    \d\d\p{L}\d\d\d\-\d\d\-\p{L}\p{L}\-\d\d\d\d (Which gives an example of 00A000-00-AA-0000)

    or

    \d\d\p{L}\d\d\d\-\d\d\-\p{L}\p{L}\-\d\d\d\d\d (Which gives an example of 00A000-00-AA-00000)

    Since \d should accept any digit and p{L} should accept any letter a pattern like 56R343-11-CD-3454 should not give a validation error, but it always does. I even tried putting in the examples the custom pattern showed (00A000-00-AA-0000) but it still gave me a validation error. Am I overlooking something?
  • 02-13-2020 10:48 AM In reply to

    Re: Data validation error for field with custom pattern validation

    So - your second expression has 5 digits at the end, and your sample value has four (3454). If I add another digit to your sample value, using your second pattern, validation works as anticipated.... I'm wondering if you are using "and" or "or" in the validation conditions? The condition is that the field does not match the pattern, right? So you'd need to use and there - if it doesn't match both patterns, then it is invalid?
    Hilary Stoupa

  • 02-13-2020 12:11 PM In reply to

    Re: Data validation error for field with custom pattern validation

    Hi Hilary, I currently have it set as "does not match pattern" using the "or" validation condition so the user will have the option or four or five digits at the end.
  • 02-13-2020 02:59 PM In reply to

    Re: Data validation error for field with custom pattern validation

    Missed that, sorry - but did you try "and"? Because what you are effectively saying with "or" is that if the data doesn't match this or that, it is invalid. And it can't match both. You could also consolidate the pattern. See the attached sample - save locally, right click and select design then you can preview. :)
    Hilary Stoupa

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