optional¶
Description¶
The optional keyword allows the form elements to be hidden or shown
based on the state of other form elements. Sections or multiple
sections can be enclosed within an optional element.
Syntax¶
optional ( <expression> ) { <contents> }
Notes¶
From the developer’s guide:¶
No Tcl insertion inside optionals: Reliable execution cannot be
guaranteed because optional states are unpredictable.
Optionals inside tables must depend on elements outside the table:
iApps cannot locate variables inside a template’s table, so they must
be located outside the APL table element structure.
Examples¶
section example8 {
choice ssl_enabled default "false" {"true", "false"}
optional (ssl_enabled == "true") {
choice cert default "default.crt" display "large" { "my.crt", "your.crt", "his.crt" }
choice key default "default.key" display "large" { "my.key", "your.key", "his.key" }
}
}
text {
example8 "SSL Parameters"
example8.ssl_enabled "Enable SSL? "
example8.cert "SSL Certificate: "
example8.key "SSL Key: "
}
Resulting UI presentation: