Field Validation Doesn't Re-Validate after a change in the data - InfoPath Dev
in

InfoPath Dev

Field Validation Doesn't Re-Validate after a change in the data

Last post 03-21-2014 06:17 AM by JeffVojtko. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-19-2014 07:32 AM

    Field Validation Doesn't Re-Validate after a change in the data

    I am running across an issue; I have a textbox field where I validate the content and set another field to either "Good" or "Error" and then show the
    error on the initial field. But, this only works on the initial validation. (First time through) The rules don't seem to work after the first time through. I need
    the validation rules to fire whenever a data element is changed in this initial field. Any help would be greatly appreciated.

    Here are the rules:

    Good rules:

    1) starts-with(., "P") or starts-with(., "A")
    2) substring(., 2, 4) = ../../../my:SystemCode
    3) substring(., 6, 3) = "SPM"
    4) substring(., 9, 1) = "."
    5) substring(., 17, 1) = "S"
    6) xdUtil:Match(string(substring(., 14, 3)), "\d\d\d")

    Error rules:

    1) not(starts-with(., "P")) or not(starts-with(., "A"))
    2) substring(., 2, 4) != ../../../my:SystemCode
    3) substring(., 6, 3) != "SPM"
    4) substring(., 9, 1) != "."
    5) substring(., 17, 1) != "S"
    6) not(xdUtil:Match(string(substring(., 14, 3)), "\d\d\d"))

    Jeffrey J Vojtko
  • 03-21-2014 06:17 AM In reply to

    Re: Field Validation Doesn't Re-Validate after a change in the data

    Wow! That was tough. I found an article online that talked about a possible way to build an If-Else..Then statement in InfoPath. The article spoke about using a Concat statement. My issue was that the rules above only set the Error/Good field on the very first attempt. I had to create a rule that ran on Field Change. So, I created an Action step and left the Condition blank and put in some variation of the following statement to get my field conditions to return the correct value:

    concat(substring("Error", 1, (not(starts-with(., "P")) and not(starts-with(., "A")) and not(starts-with(., "Q")) and not(starts-with(., "R")) and not(starts-with(., "U")) and not(starts-with(., "T")) or substring(., 2, 4) != SystemCode or substring(., 6, 3) != "SPM" or substring(., 9, 1) != "." or substring(., 17, 1) != "S" or not(xdUtil:Match(string(substring(., 14, 3)), "\d\d\d"))) * string-length("Error")), substring("Good", 1, ((starts-with(., "P")) and (starts-with(., "A")) and (starts-with(., "Q")) and (starts-with(., "R")) and (starts-with(., "U")) and (starts-with(., "T")) and substring(., 2, 4) = SystemCode and substring(., 6, 3) = "SPM" and substring(., 9, 1) = "." and substring(., 17, 1) = "S" and (xdUtil:Match(string(substring(., 14, 3)), "\d\d\d"))) * string-length("Good")))

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