One of the reasons that EWD significantly reduces development times and maintenance overheads is that it will automatically map name/value pairs from the incoming HTTP Request to the EWD Session whenever it is safe to do so. This saves a great deal of coding and avoids some values being mistakenly not persisted. So, for example, if EWD's compiler finds links within EWD pages that explicitly define name/value pairs in the URL queryString, those name/value pairs will be automatically mapped to the EWD Session and will therefore be persisted throughout the user's session. For example if your EWD page contained a link such as:

  <a href="myNextPage.ewd?country=UK&myName=#name">Go to next page</a>

then by the time myNextPage's pre-page script fires, EWD will already have instantiated two Session variables:

EWD deems this safe to do because these name/value pairs have been explicitly defined in the EWD page link and are therefore expected in the incoming HTTP request. Any other name/value pairs that a malicious user might try to add to the URL will be ignored by EWD and left in the HTTP request.

If you use HTML forms, then EWD will once again automatically map the posted form field name/value pairs into corresponding EWD Session variables, mapped using the form field's name attribute value. For example, if your EWD page contained the following form:

   <form method="post" action="ewd">
     First Name: <input type="text" name="firstName" value="*" />
     Last name: <input type="text" name="lastName" value="*" />       
     City: <select name="city"></city>      
     <input type="submit" name="submit" value="Save" action="##class(ewd.examples).setMyData" nextPage="mainMenu" />
   </form>

then when the form is POSTed, by the time the Action script (##class(ewd.examples).setMyData) fires, EWD will already have automatically created the following Session values:

The values of these EWD Session variables will be whatever the user had entered into the form fields at the time it was submitted. This makes Action scripts very easy to code. In order to validate and manipulate the values of submitted form fields, you simply use API Methods such as getSessionValue, eg:

ClassMethod setMyData(sessid As %String) As %String
{
 s firstName=$$getSessionValue^%zewdAPI("firstName",sessid)
 i firstName="" QUIT "You must enter a first name"
 s lastName=$$getSessionValue^%zewdAPI("lastName",sessid)
 i lastName="" QUIT "You must enter a last name"
 s city=$$getSessionValue^%zewdAPI("city",sessid)
 d ##class(ewd.examples).saveData(firstName,lastName,city)
 QUIT ""
}

If an EWD form includes a field whose name has a variable component, eg:

     Name <?=$no ?>: <input type="text" name="name<?= $no ?>" value="*" />

then EWD's compiler has no way of knowing what the name will actually be at run-time, so it errs on the side of caution and will leave the name/value pair in the HTTP Request. If you need to validate and process such fields, you'll have to get the value from the HTTP Request yourself and optionally persist it in the EWD Session, for example:

ClassMethod setMyData(sessid As %String) As %String
{
 s name1=$$getRequestValue^%zewdAPI("name1",sessid)
 i name1="" QUIT "Name1 was not defined"
 d setSessionValue^%zewdAPI("name1",name1,sessid)
 QUIT ""
}

You can also transfer a name/value pair from the HTTP Request to the EWD Session with a single API method:

 d copyRequestValueToSession^%zewdAPI("name1",sessid)

Further information on how EWD automates HTML form processing is detailed under the Form tab.