Data Validation on Sometimes Hidden Field - InfoPath Dev
in

InfoPath Dev

Data Validation on Sometimes Hidden Field

Last post 07-25-2012 09:36 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-25-2012 08:39 AM

    • alexj
    • Not Ranked
    • Joined on 07-05-2012
    • Posts 18

    Data Validation on Sometimes Hidden Field

    I apologize for this question, as I have already seen an answer that seems quite intuitive

     http://social.msdn.microsoft.com/Forums/en-US/sharepointinfopath/thread/26cc5f3e-62d1-4562-a53e-82c8e045305f/

    However, I can't quite seem to wrap my head around how to actually do it

     The specific case is that I need to collect the employee number only when employee is going to be training, but when they are training it must be completed

     There is a dropdown box with a list of 'Purposes', which include Training and Conference.

    The section containing the employee number field is set to 'Hide when Purposes not equal training AND Purposes not equal Conference' using a conditional formatting rule

     So I need to set data validation to . . .

    (Purposes Is Equal To Training OR Purposes Is Equal To Conference) then Employee Number should not be blank

     But I am not getting how to actually do this

     Could someone help guide me how to set this up?

     

     

  • 07-25-2012 08:50 AM In reply to

    Re: Data Validation on Sometimes Hidden Field

    No need to ever apologize for a question - they are all valid.

    So, you need to add data validation to your Employee Number field - first, add a validation rule. The rule will have the following conditions:

    Employee Number is blank
    AND
    Purposes is equal to Training
    OR
    Employee Number is blank
    AND
    Purposes is equal to Conference

    For InfoPath 2010, you can add a validation rule to the Employee Number field by selecting the field in the Data Fields Task Pane or by clicking on a control bound to the field and selecting Manage Rules - Validation rule can be selected just like formatting or action. Let me know if you need more information.

    Hilary Stoupa

  • 07-25-2012 09:07 AM In reply to

    • alexj
    • Not Ranked
    • Joined on 07-05-2012
    • Posts 18

    Re: Data Validation on Sometimes Hidden Field

    Splendid, that works!

    Could you possibly explain a bit how you figured that out?  I don't quite understand how the multiple part condition works especially as there are no parentheses

  • 07-25-2012 09:36 AM In reply to

    Re: Data Validation on Sometimes Hidden Field

    Yeah, a lot of times I change the first drop down to "The expression" and sort of put my own XPath together, because my brain requires lots of parentheses to understand this stuff. In general, I assume that if I use an "OR" condition in IP, I have to make sure I have an entire expression on each side of it. We include the Employee Number is blank because once it has data in it, it is valid. I use it on either side of the OR because I am pretty sure that if I do this - ConditionA AND ConditionB OR ConditionC - InfoPath will do this - (ConditionA AND ConditionB) OR ConditionC.

    Hilary Stoupa

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