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.01 config end
 2: 00.21 00.20 MarkupToHTML begin
 3: 00.21 00.20 MarkupToHTML begin
 4: 00.22 00.21 MarkupToHTML end
 5: 00.22 00.21 MarkupToHTML begin
 6: 00.22 00.21 MarkupToHTML end
 7: 00.22 00.21 MarkupToHTML begin
 8: 00.23 00.22 MarkupToHTML end
 9: 00.23 00.22 MarkupToHTML end
10: 00.24 00.23 MarkupToHTML begin
11: 00.25 00.24 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
12: 00.25 00.24 ReadApprovedUrls SiteAdmin.ApprovedUrls end
13: 00.26 00.25 MarkupToHTML end
14: 00.26 00.25 MarkupToHTML begin
15: 00.26 00.25 MarkupToHTML end
16: 00.26 00.25 now
Peak memory: 3,717,464 bytes