InputSelectNestingSource


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]]
>><<
 0: 00.00 00.00 config start
 1: 00.01 00.00 config end
 2: 00.08 00.02 MarkupToHTML begin
 3: 00.09 00.02 MarkupToHTML begin
 4: 00.12 00.03 MarkupToHTML end
 5: 00.12 00.03 MarkupToHTML begin
 6: 00.12 00.04 MarkupToHTML end
 7: 00.12 00.04 MarkupToHTML begin
 8: 00.13 00.04 MarkupToHTML end
 9: 00.17 00.05 MarkupToHTML end
10: 00.17 00.05 MarkupToHTML begin
11: 00.19 00.06 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
12: 00.20 00.06 ReadApprovedUrls SiteAdmin.ApprovedUrls end
13: 00.21 00.07 MarkupToHTML end
14: 00.21 00.07 MarkupToHTML begin
15: 00.22 00.08 MarkupToHTML end
16: 00.23 00.08 now
Peak memory: 3,133,600 bytes