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 EnablePost = 1, keys=
 1: 00.00 00.00 config start
 2: 00.01 00.01 config end
 3: 00.04 00.03 MarkupToHTML begin
 4: 00.04 00.03 MarkupToHTML begin
 5: 00.05 00.04 MarkupToHTML end
 6: 00.05 00.04 MarkupToHTML begin
 7: 00.05 00.04 MarkupToHTML end
 8: 00.05 00.04 MarkupToHTML begin
 9: 00.05 00.04 MarkupToHTML end
10: 00.06 00.05 MarkupToHTML end
11: 00.07 00.06 MarkupToHTML begin
12: 00.07 00.07 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
13: 00.08 00.07 ReadApprovedUrls SiteAdmin.ApprovedUrls end
14: 00.08 00.08 MarkupToHTML end
15: 00.08 00.08 MarkupToHTML begin
16: 00.09 00.08 MarkupToHTML end
17: 00.09 00.08 now
Peak memory: 3,995,672 bytes