Show optional section dynamically

F

Francisco

Hello all,

I have two option buttons (yes/no), that when the users selects "Yes" an
optional section needs to show.

I am using InfoPath 2007. I already got how to get the value selected by
the user using the OnAfterChange function, but now I need to get the part
where the optional selection shows. Any hints will be greatly appreciated.
thank you.


<InfoPathEventHandler(MatchPath:="/my:lw/my:signedData/my:details/my:alcoholServed", EventType:=InfoPathEventType.OnAfterChange)> _
Public Sub alcoholServed_OnAfterChange(ByVal e As DataDOMEvent)
' Write your code here to restore the global state.
Dim strOption As String

strOption =
FirmToolbar.GetNodeValue("/my:lw/my:signedData/my:details/my:alcoholServed")

If strOption = "Yes" Then
' An undo or redo operation has occurred and the DOM is
read-only.

Return
End If

' A field change has occurred and the DOM is writable.
' Write your code here.
End Sub
 
E

Ed Thurber

is there a reason you need to do this with code?

you can use conditional formatting on the Optional Section to hide if the
value = false. this won't add the optional section, it will only control
the visibility of the control.

Ed
 
S

Swathi (GGK Tech)

Hi,

You can implement this using conditional formatting by following the below
steps.

1.Go to optional section properties.
2.Go to Display tab-> conditional formatting.
3.Select the optional button in the first drop down, equal to in the second
drop down and ‘Yes’ in the third drop down then check the Hide this control
check box.

I hope this helps to you.
 

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