Why Use a Form

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 /Examples/DC/InputGridSimple 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.

I understand these instructions

[0] :ClassFormSimple : MiPageSample[1] ⍝ Control:: _DC.Form [2] ⍝ Description:: Explain about Forms [3] [4] :Field public check←''[5] [6] ∇ Compose[7] :Access Public
[8] [9] f←'output'Add_.Form[10]f.Add_.h2'Why Use a Form'[11][12]f.AddWrapFollowing'p'[13] ⍝ Any MiServer page which is going to be used to post data back to the server [14] ⍝ will need a form. If you use a classical Submit button, all the input elements [15] ⍝ within the form that the button is in will be sent to the server as part of the POST. [16] ⍝[17] ⍝ If you use events and AJAX-style interaction, the default handler will serialise [18] ⍝ the contents of the form and post it back to the server. See [19] ⍝ see <a href="/Examples/DC/InputGridSimple" target="_blank">/Examples/DC/InputGridSimple</a> for an example of this style of coding, [20] ⍝ which is becoming more and more popular. [21] ⍝[22] ⍝ In either case, values that are posted back to the server will be available using the Get function [23] ⍝ (using the name of an element to retrieve the value that was posted back). Also, if your MiPage exposes [24] ⍝ public fields with the same name, it will automatically be populated with the incoming value. [25][26]:If'on'≡Get'check'[27]f.Add_.p'You understood these instructions'[28]:Else[29]f.Add_.p('#check'New_.Input'checkbox''on''I understand these instructions''right')[30]f.Add_.p('#submit'New_.SubmitButton'Submit')[31]:EndIf[32]∇[33][34]:EndClass