Infopath validation - show a message based on a control selection?

Posted on 2011-04-25
Last Modified: 2013-12-13

I'd like to create a form in Infopath 2007 that shows a "hint" type text based on user's selection of a particular dropdown and possibly changes whether another control is required in order to submit (the asterisk). The logic would be:

Dropdown value = X, display "you must enter destination when using this service", and set control2 to REQUIRED.

Dropdown value = Y, display no text, and don't change any required fields (unless user already selected X in dropdown, then put it back to defaults now)

Is that possible WITHOUT code?

And how does that change in Infopath2010 - if at all?

thanks :)
Question by:runelynx
    LVL 28

    Accepted Solution

    Yah this is possible without code in both IP 2007 and 2010.

    You have 2 peices.

    You have the notifications, which could be a message window or I often use a hidden section or text box. I update the text and make it appear and hide as needed.  

    The other issue is control the required peice.  You have to use your own rules. So have a field which controls the required state. Then add a rule on submit or on another required field that if required state is true and control2 is blank show a message and do not complete or whatever to block them until control2 has a value.

    Hope that helps.

    Start small and play with it a lot to get the feel for it.

    Author Comment

    Ok that seems simple enough.

    I'm keeping it very simple... 1 dropdown w/ 3 options, and 1 blank rich text field to show messages depending on the selection in the dropdown.

    The dropdown has values 1, 2, or 3.

    I set a rule to make the rich text field say "test" if the dropdown is "1" - and it works :)   But if you change to 2, 3, or blank, the text stays in the rich text field and I don't really want that. Is there an easy way to make this clear out or do I need to set a rule for each possibility in the dropdown?

    Author Comment

    If I make a validation rule to show a ScreenTip - where does that tip show up? I'm in the filler and it doesnt show up unless I make it do a dialog box as well...

    Author Comment

    Whoohoo I got it :D

    I can add a new rule to blank out the textbox whenever the dropdown changes, and just put that above the other one so it does both.

    And i found the screentip, silly little hover thing, not very useful.

    One thing, however, still perplexes me...   is it possible to make a control "cannot be blank" (i.e. required) when another control has a certain value?  I can't find any rules to do this...
    LVL 28

    Expert Comment

    You cannot use the default cannot be blank, you have to add the conditions to your rules manually so that the process does not run unless your conditions are met.

    Glad you got it.

    I have found it just takes lots of tinkering and baby steps to get a good feel for what can be done.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    If your app took Google’s lash recently, here are the 5 most likely reasons.
    Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
    The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
    The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now