Anyone who can write an APL function should be able to host it on the web.™
Rendered webpage |
APL code |
:Class FormSimple : MiPageSample
⍝ Control:: _DC.Form
⍝ Description:: Explain about Forms
:Field public check←''
∇ Compose
:Access Public
f←'output'Add _.Form
f.Add _.h2'Why Use a Form'
f.Add WrapFollowing'p'
⍝ Any MiServer page which is going to be used to post data back to the server
⍝ will need a form. If you use a classical Submit button, all the input elements
⍝ within the form that the button is in will be sent to the server as part of the POST.
⍝
⍝ If you use events and AJAX-style interaction, the default handler will serialise
⍝ the contents of the form and post it back to the server. See
⍝ see <a href="/Examples/DC/InputGridSimple" target="_blank">/Examples/DC/InputGridSimple</a> for an example of this style of coding,
⍝ which is becoming more and more popular.
⍝
⍝ In either case, values that are posted back to the server will be available using the Get function
⍝ (using the name of an element to retrieve the value that was posted back). Also, if your MiPage exposes
⍝ public fields with the same name, it will automatically be populated with the incoming value.
:If 'on'≡Get'check'
f.Add _.p'You understood these instructions'
:Else
f.Add _.p('#check'New _.Input'checkbox' 'on' 'I understand these instructions' 'right')
f.Add _.p('#submit'New _.SubmitButton'Submit')
:EndIf
∇
:EndClass