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.


optional ( <expression> ) { <contents> }


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.


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: "

Codeshare Entries

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.