Hidden section not displaying when using rule criteria - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Hidden section not displaying when using rule criteria

Last post 04-20-2018 12:44 PM by Hilary Stoupa. 32 replies.
Page 1 of 3 (33 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 04-10-2018 01:24 PM

    Hidden section not displaying when using rule criteria

    Hi All!

    This is my 1st post and I'm sort of new with InfoPath so be kind. :) I'm using 2013 and I have a form I've built with text fields, drop down boxes, multi-select boxes and a hidden section. I built this form so I know everything about it and it works well and functions as designed. I recently got a request to add another hidden section with a new dropdown box. My Training Enrollment team wants the following: When a user selects a Reporting 100 Class, from our Class dropdown box, show a new section that contains the new drop down box.

    So I created the new dropdown box in SP. Then opened my form in InfoPath and added the new section that will be conditionally hidden. I then add the new dropdown box to the soon to be hidden section, I select the section and add a formatting rule. 

    The rule is as follows. Condition: Class Does not Begin With "Reporting 100", Hide this control.

    The Class dropdown box contains unique values like:

    Registration 300 at Room 7 at 5pm on 4/15/2018
    Reporting 100 at Room 9 at 1pm on 4/16/2018 
    Billing 200 100 at Room 8 at 8am on 4/17/2018
    Reporting 100 at Room 5 at 1pm on 4/18/2018  

    These Class values change daily. The only constant is the class name in the beginning which is why I created a rule using the "Does not Begin With" logic. I only want the Reporting 100 classes to unhide the new section with the new dropdown. I cannot get it to work at all. It seems that it wants the literal full value. As a test when I create a rule using the full Class value ("If Class Does not Begin With "Reporting 100 at Room 9 at 1pm on 4/16/2018", Hide this control.") it works.

    Hmmm. Can't figure this out. Why doesnt the "Does not Begin With" work?  I have another conditional hidden section that works perfectly but it utilizes a multi-select box with static values.

    What I am missing or doing wrong??? Thanks in advance for your help.

  • 04-10-2018 02:22 PM In reply to

    Re: Hidden section not displaying when using rule criteria

    I'm attaching a simple sample - save it locally, right click the saved file and select design, then preview - I'm using a color formatting condition instead of hiding the section (that's how I debug complex formatting rules, makes it easier to see what's happening). In general, when conditional formatting doesn't work, it usually means the value isn't what I anticipate - feel free to attach a copy of your form under the Options tab in a reply if you'd like me to take a look.
    Hilary Stoupa

  • 04-11-2018 06:14 AM In reply to

    Thank you Hilary!

    I viewed your sample and it looks to be using the same logic as mine unless I'm missing something. I've attached my sample for your review.

     

    EDIT: FYI the Class drop down box data is based on a list within the same SP site. 

  • 04-11-2018 09:13 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    OK! So, here's what I think your issue is. The Class dropdown displays the text in the title of the list it uses for the lookup - but the actual value is the ID. I don't understand how your attempt with the full text was working in this scenario, but I'm attaching a copy of your form that I *think* will work correctly. If it doesn't, let me know, and I can help you debug it. :) Save it locally. Right click and select design to open in design mode. Then you can preview and see if it works.
    Hilary Stoupa

  • 04-11-2018 10:39 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    That worked Hilary! I have to admit I'm a little confused though. When I view the SharePoint list in Access (this is how it gets updated daily), I see the values in the ID field as numeric and the class as text. See attachment. Huh? :) 

     And let me just take an aside and say I've never been given such direct and thorough assistance from a forum member. Thank you so much for the quick and personal help. :)


  • 04-11-2018 10:48 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    In your InfoPath form, right click on the Class dropdown and select the dropdown properties. On the first tab, you'll see the data source is your class list, the value is the ID, and the display is the Class. So, in the list that your form is bound to - Class is a lookup. SharePoint is going to store IDs in the lookup column - this is because an item's ID lasts its entire life, while you could go into the list and change that text. :)
    Hilary Stoupa

  • 04-11-2018 11:23 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    Thank you for the explanation. Ok. I am looking at the rule you sent me. Its using an expression for the condition:

    not(starts-with(xdXDocument:GetDOM("ClassInfoForEnrollementForm")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Class[../d:ID = current()/my:Class], "Reporting 100"))

    Is there a way to generate that expression using the interface?

    I went back to the version I sent you originally and, sure I could paste your code into my rule but I thought there would be a way using the interface to pull the ID from ClassInfoForEnrollementForm. I found the ID column in Advanced view in two spots but neither worked for me when I added them to the Condition criteria instead of Class.


  • 04-11-2018 11:53 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    Yeah, this is one of those things that you end up having to manually create. I use the formula editor to see if I have my syntax right. But there isn't an option in the first dropdown to add a filter via the UI.
    Hilary Stoupa

  • 04-11-2018 12:35 PM In reply to

    Re: Hidden section not displaying when using rule criteria

     Ok then. I'll make note of the syntax and re use it if necessary. Thanks so much for all of your help!

  • 04-12-2018 06:19 AM In reply to

    Hi Hilary!

    Sorry to bother you again. One final step I need to accomplish is to make the conditional dropdown box required. I've accomplished this for another conditional dropdown on the form but using the same logic and your code, the field still refuses to be set to Required. I've attached the form in case you want to see it but the rule is as follows.

    Validation Rule

    Expression: starts-with(xdXDocument:GetDOM("ClassInfoForEnrollementForm")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Class[../d:ID = current()/my:Class], "Reporting 100")      AND

    Reporting Security Access Is Blank

    Any idea why that field is not being set to required using the above conditions? I tried to get this to work yesterday evening with no luck. :(  Iguess there's a lot more I need to learn about InfoPath 

    Thank you! 

     

  • 04-12-2018 07:21 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    You are not a bother at all. So - the current() function is contextual. With the validation rule, it is applying to the field itself. That means you need to go up the tree one step to get the my:Class node. starts-with(xdXDocument:GetDOM("ClassInfoForEnrollementForm")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Class[../d:ID = current()/../my:Class], "Reporting 100") is the correct expression. I'm attaching a screenshot showing how I use the formula builder to help double check my XPath syntax for this tricky stuff. I basically add a condition, then use the formula builder to check the XPath I want to use. Once I know it is right, I can remove my dummy condition and just use The expression instead. It is an easy way to use InfoPath to help teach yourself XPath. :)
    Hilary Stoupa

  • 04-12-2018 08:27 AM In reply to

    Thank you for explaining that. That does make sense.

    So I've modified my Xpath formula to match yours. The dropdown box is still not required for me. See attached form.

  • 04-12-2018 08:41 AM In reply to

    Re: Hidden section not displaying when using rule criteria

    So, when you try the form and select something w/ reporting 100, the red asterisk doesn't show up? I can't preview the form to test it (because I don't have access to your SharePoint site) - but the validation rule looks right to me. You could test with an action rule with the same condition - Add an action rule that does something (sets a field or something) and then select something in the dropdown and clear it so it is blank again - see if your action rule fires.
    Hilary Stoupa

  • 04-12-2018 11:20 AM In reply to

    Re: Hidden section not displaying when using rule criteria

     No red asterisk appears. I created an Action rule using same Condition criteria. I set it to set the value of a text box to some sample text and that isn't working for me either.


  • 04-12-2018 11:22 AM In reply to

    Re: Hidden section not displaying when using rule criteria

     Here is the Test action rule. This didn't work for me.


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