The form component
The class SMForm is used to generate one global HTML Form element in the template, in which all GUI controls are added. This makes it possible for ie input form elements to automatically restore their values after post back (page submit).
The form element is accessible though the
SMContext object, available on the extension main class. It provides a few handy functions described in the following class description.
SMForm class
Function
|
Return type
|
Description
|
__construct()
|
|
Create new instance of the Form element. The form component is automatically created and added to the template by the controller. There is no need to create new instances of this class.
|
SetRender($value:boolean)
|
|
Specify whether form is rendered in template or not.
|
GetRender()
|
Boolean
|
Get value indicating whether form element will be rendered in template or not.
|
SetContentType($type:SMFormContentType)
|
|
Set content type for form element. Content types available can be found on enum SMFormContentType. To support file uploads simply invoke SetContentType( SMFormContentType::$MultiPart );
|
GetContentType()
|
SMFormContentType
|
Get content type used for form element.
|
PostBack()
|
Boolean
|
Get value indicating whether a post back was performed on the form.
|
Render()
|
String
|
Renders the form. The function is called from the controller.
|
Enum value
|
Description
|
::$Default
|
Represents the default content type of the form element in the browser, which should be "application/x-www-form-urlencoded". |
::$MultiPart
|
Use this content type in conjunction with the input file element, to support file uploads. Content type is set to "multipart/form-data".
|