Create Selectbox using nested options source

Sometimes is necessary to modify the Select box.
Here is an example how to use the same Options source
under different conditions.

The example uses the page variables "fullbox" and "shortbox".
The select options are defined somwhere (can be in an other page). They can be hidden in the >>comment<< block .

fullbox
yes
shortbox
yes

Show full selectbox (options A1,A2,...C1)

 
(:if equal {$:fullbox} yes:)
(:include {$Group}.{$Name}#Lev2#Lev2end:)
(:input select name="mybox" C1 C1:)
(:ifend:)

Show shorten selectbox (options A1,A2,...B2)

(:if equal {$:shortbox} yes:)
(:include {$Group}.{$Name}#Lev2#Lev2end:)
(:ifend:)

>>comment<<
[[#Lev2]]
(:include {$Group}.{$Name}#Lev3#Lev3end:)
(:input select name="mybox" B1 B1:)
(:input select name="mybox" B2 B2:)
[[#Lev2end]]

[[#Lev3]](:input select name="A" 1 A1:)
(:input select name="mybox" 2 A2:)
[[#Lev3end]]
>><<

How to cut select box

Display options 1,2,...4 or 3,4 depending on page variable {$:cutbox}
Use when you need to include original values (if they exist ... option 1,2) or cut the menu when original values do not exist yet.

Feel free to edit the page and change the cutbox to no

cutbox
yes
(:include {$Group}.{$Name}#usr1#usr1end:)

>>comment<<
[[#usr1]]
(:include {$Group}.{$Name}#defa1#defa1end:)
(:input select name="mybox" B1 3:)
(:input select name="mybox" B2 4:)
[[#usr1end]]

[[#defa1]]
(:if !equal {$:cutbox} yes:)
(:input select name="mybox" original1 1:)
(:input select name="mybox" original2 2:)
(:ifend:)
[[#defa1end]]
>><<
This is Test / InputSelectNestingSource.
Edit Page - Page History - Printable View - Recent Changes - WikiHelp - SearchWiki
Page last modified on September 10, 2011, at 05:03 PM $StopWatch