Anyone who can write an APL function should be able to host it on the web.™
Rendered webpage |
APL code |
Notice the Search-Box within the Dropdown! That is a standard-feature from Chosen. All parameters etc, are the same as for Select-Elements.
:Class ChosenSimple : MiPageSample
⍝ Control:: _JS.Chosen
⍝ Description:: Pick fruits from a simple drop-down
⍝
FRUITS←'Apples' 'Bananas' 'Grapes' 'Oranges' 'Pears' 'Pineapples' 'Plums'
∇ Compose;frm;single;multi;btn;ch
:Access public
Add _.h2'Please pick a fruit'
Add _.p'Notice the Search-Box within the Dropdown! That is a standard-feature from Chosen. All parameters etc, are the same as for Select-Elements.'
frm←'myform'Add _.Form
ch←'fruit'frm.Add _.Chosen (,⊂FRUITS)
'width'ch.Set'6em;'
btn←'btnPressMe'frm.Add _.Button'Pick'
btn.On'click' 'onPick'
'output'Add _.div
∇
∇ r←onPick;selected
⍝ Called when the Pick button is pressed
:Access Public
⍝ When selecting a single item the result will be a string
selected←Get'fruit'
r←'#output'Replace _.p('You picked: ',selected,(0=⍴selected)/'nothing')
∇
:EndClass