Set condition to open an Optional Section automatically

M

mdsmitty

Can you open an optional section automatically when a value is set in a field
or drop-down list? I want to select a value from a drop-down list and have a
corresponding optional section open automatically for the user to fill out.
Example: If I select "Male" from the drop-down list in my "Patient
Demographics" section then the "Male Physical Exam" optional section
automatically opens.
 
M

mdsmitty

Thanks Greg

It makes sense, and I was able to hide the section (this is an "Optional
Section" from the Controls task pane) using the conditional formatting.
However, what I want to do is have the section hidden when the from is opened
and when the user selects "Male" or "Female" from a drop-down list, the
corresponding section will open automatically. Is there an easy method for
me to accomplish this by using the Properties dialogs or will I need to write
a line of code/script to do it?

Thanks again, you are a great guide through this InfoPath jungle.

mdsmitty
 
M

mdsmitty

Thanks Greg, I'll tinker with that and see if it will come out the way I want
it to. Have a good day.

Greg Collins said:
If you set up the two sections (one for Male and one for Female), and place conditional formatting on each of them such that the Male one hides when the drop-down value is NOT male, and the Female one hides when the drop-down value is NOT female, then you are set.

Then if the drop-down value is BLANK by deault (i.e. not male nor female), then both sections will be hidden when the form is opened.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



Thanks Greg

It makes sense, and I was able to hide the section (this is an "Optional
Section" from the Controls task pane) using the conditional formatting.
However, what I want to do is have the section hidden when the from is opened
and when the user selects "Male" or "Female" from a drop-down list, the
corresponding section will open automatically. Is there an easy method for
me to accomplish this by using the Properties dialogs or will I need to write
a line of code/script to do it?

Thanks again, you are a great guide through this InfoPath jungle.

mdsmitty

Greg Collins said:
You are speaking of optional sections. Optional means that it either does or does not exist in the XML. If that is truly what you meant then you will need an OnAfterChange event handler that inserts or removes the section from the XML using code.

If the section is always going to be present in the XML, then this is not an optional section, but rather a conditionally visible section. That is much more simple. For this you add condtional formatting to hide the section unless the value of the specified field meats your criteria.

Does this make sense?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



Can you open an optional section automatically when a value is set in a field
or drop-down list? I want to select a value from a drop-down list and have a
corresponding optional section open automatically for the user to fill out.
Example: If I select "Male" from the drop-down list in my "Patient
Demographics" section then the "Male Physical Exam" optional section
automatically opens.
 
M

Mary Deaton

I have read the various threads about optional sections, and I am still a bit
confused. I have a form that contains one main section and one sub-section
(how is a group and a sub-section different, anyway?) within it. The main
form has a field called Status, which has a list of options the user can
select when filling out the form.

When the Status field is set to a particular option, an optional section
should be displayed in order to the user to fill out this new information -
it is a request to cancel a previous request.

I set up the optional section below the main section, rather than within the
main section. I then it a condition that when the Status field does NOT equal
the cancellation status, the optional section should no longer be hidden.
There was no option in the dialog box in which the section is hidden by
default and only shown when the condition is matched.

When I preview the form or when I open the form as a user to fill it out,
choosing the Status option that is supposed to cause the section to display
does not cause it to display.

I am an InfoPath novice, so I am wondering if I have put the optional
section in the wrong place, selected the wrong kind of section (I selected
optional section with controls), have set up the condition incorrectly, or
have done something else entirely.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top