Anyone who can write an APL function should be able to host it on the web.™
Rendered webpage |
APL code |
:class formSimple: MiPageSample
⍝ Control:: _html.form _html.input _html.textarea _html.select _html.option _html.optgroup _html.fieldset _html.label _html.keygen _html.legend
⍝ Description:: Arrange many interactive elements together
∇ Compose
:Access public
myform←'method=post action=./formSimple' Add _.form
myform.Add _.h2'Lots of options in one form'
⍝ This adds a box with an embedded legend
mybox←myform.Add _.fieldset
mybox.Add _.legend'Text input'
'for="user"'mybox.Add _.label'User name: '
'#user name=user'mybox.Add _.input
mybox ShowInput'user'
mybox.Add¨2/_.br
'#text name=text cols="50"'mybox.Add _.textarea'Anyone who can write an APL function should be able to host it on the web.™'
mybox ShowInput'text'
mybox.Add¨2/_.br
'for="number"'mybox.Add _.label'Numeric field: '
'#number name=number type=number value=42'mybox.Add _.input
mybox ShowInput'number'1
mybox←myform.Add _.fieldset
mybox.Add _.legend'Selection'
'for="prim"'mybox.Add _.label'Primitives: '
primitives←'#prim name=prim multiple'mybox.Add _.select
mybox ShowInput'prim'
fns←'label="Functions"'primitives.Add _.optgroup
fns.Add¨(_.option,⊂)¨'Ceiling' 'Floor' 'Encode' 'Decode'
ops←'label="Ops"'primitives.Add _.optgroup
ops.Add¨(_.option,⊂)¨'Each' 'Commute' 'Power' 'Rank'
mybox.Add¨2/_.br
mybox.Add'Security: '
'name="security"'mybox.Add _.keygen
mybox←myform.Add _.fieldset
mybox.Add _.legend'Submission'
'type=reset'mybox.Add _.input
'type=submit'mybox.Add _.input
∇
∇ parent ShowInput field_num
(field num)←2↑(⊆field_num),0
:If _Request.isPost
val←∊(⊂'<br />')@((⎕UCS 13)∘=)¯1↓∊',',⍨¨⊆Get field
('style="border:green solid" #SI',field)parent.Add _.p(' Submitted value was "<tt>',val,'</tt>"',num/', as a number: ',⍕0 Get field)
:EndIf
∇
:endclass