The SubmitButton control will cause a submission of the form that it is in back to the server.
Unlike callbacks that are set up using handlers or the On function, this will cause the
Compose function to run each time the button is pressed. Because the class has two
public fields with the same name as the EditFields created below, MiServer will populate
these two variables with the input each time the form is posted back.
Today, this type of page, which refreshes completely each time the button is pressed,
is considerd old-fashioned: new applications should use AJAX-style interation, as do
the vast majority of the MS3 samples.
:Class SubmitButtonSimple : MiPageSample
⍝
⍝
:Field Public fname←''
:Field Public lname←''
∇ Compose;frm;field;prompt;value;fieldset;hello;inputs
:Access Public
Add _.style'#Submit {font-weight: bold; font-size: large;}'
:If _Request.Method≡'get' ⍝
fname←lname←''
:EndIf
Add _.p ScriptFollows
⍝
⍝
⍝
⍝
⍝
Add _.p ScriptFollows
⍝
⍝
⍝
frm←Add _.Form
fieldset←frm.Add _.Fieldset'Personalia:' ⍝
inputs←fieldset.Add _.InputGrid
inputs.Labels←'First Name:' 'Last Name:'
inputs.Inputs←{⍵ New _.EditField ⍵(⍎⍵)}¨'fname' 'lname'
Add _.br
'Submit'frm.Add _.SubmitButton
'Reset'frm.Add _.ResetButton
:If 0≠⍴fname,lname ⋄ hello←' +!'⎕R'!'⊢'Hello, ',fname,' ',lname,'!'
:Else ⋄ hello←'' ⋄ :EndIf
'output'Add _.div hello
∇
:EndClass