Conditional Validation Error on Text field - InfoPath Dev
in

InfoPath Dev

Conditional Validation Error on Text field

Last post 02-12-2013 09:01 AM by bhben. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-12-2013 01:55 AM

    • bhben
    • Not Ranked
    • Joined on 08-21-2012
    • Posts 5

    Conditional Validation Error on Text field

    Hi, I have a field called category, when "category 2" is selected in this field a people picker (Called AssignedTo) appears which i want to be mandatory ONLY when category is selected - i.e. i need conditional validation. Because you can't add a validation rule to a people picker field, I have created a text field called AssignedToTB. The default value of AssignedToTB is the DisplayName element of the AssignedTo people picker. I have added a validation rule to the AssignedToTB field that says if category is equal to Category 2, the AssignedToTB becomes a required field.

    I added the AssignedToTB field to the bottom of the form to test the problem that I am experiencing: 

    In previewing the form, I select Category 2 meaning the people picker appeared (its in a section with a rule to make the setion appear). The AssignedToTB field also gets a red asterix - as it should because the validation rule is now activated. Then I enter a valid name of an employee into the people picker field (lets say Joe Bloggs) and in the AssignedToTB field the red asterix changes to a red dashed border suggesting that the contents are invalid. The form fails to submit using the custom submit button throwing up a validation error. The custom submit button sets the value's of some unrelated fields and initiates a data connection which emails the form

    The AssignedToTB field is text (string), with no formatting rules. The field is set to refresh when the formula is recalculated.

    As far as i can see, there is no reason why a name such as Joe Bloggs is classed as invalid data in a text (string) field.

    Does anyone haev any ideas why this might be happening?

    Thanks,

    Ben

  • 02-12-2013 09:01 AM In reply to

    • bhben
    • Not Ranked
    • Joined on 08-21-2012
    • Posts 5

    Re: Conditional Validation Error on Text field

    I found the problem, it was the conditions on my validation.

    The validation was only looking at the category field whether the text box was blank or not. I added a second condition to the validation rule saying if the category field equals category 2 AND AssignedToTB is blank, then perform the validation.

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