Formatting output Plese Wait...
Works as a container of GET/POST.
More...
Detailed Description
Works as a container of GET/POST.
$request->get
or $request->post
both are actually an Instance of zRom_form Class. This class works like a Container or all Get or post Field(s). actually There is a composition relation between zRom_fields and zRom_form cause all fields are contained into zRom_form as a zRom_fields object
Definition at line 162 of file map.php.
Constructor & Destructor Documentation
zRom_form::__construct( string $method = null
)
Sets the Form Method First argument should be either get or post in any case if no arguments are given it would try to detect the form method.
- Parameters:
-
Reimplemented from validation.
Definition at line 184 of file map.php.
References validation::$method, and perror().
Show Source00184 {
00185 parent::__construct($method);
00186
00187 switch($method){
00188 case 'GET':
00189 if(count($_GET) >= 1){
00190 $this->items = $_GET;
00191 $this->is_submited = true;
00192 }else{
00193 $this->is_submited = false;
00194 }
00195 $this->frm_method = '_GET';
00196 break;
00197 case 'POST':
00198 if(count($_POST) >= 1){
00199 $this->items = $_POST;
00200 $this->is_submited = true;
00201 }else{
00202 $this->is_submited = false;
00203 }
00204 $this->frm_method = '_POST';
00205 break;
00206 default:
00207 perror('Invalid method name supplied');
00208 }
00209
00210 }
Top
Member Function Documentation
zRom_form::zRom_form( string $method = null
)
zRom_form::initValidator( string $map_file )
Initilizes the validation System.
Validates the form by the provided Validation Map Name.
- Parameters:
-
| $map_file | Name of the Validation Map e.g. if the map Name is abcd.vld.map.php just specify ancd here |
Definition at line 217 of file map.php.
References validationCore::$rules, zLogger::debug(), validationCore::errtext(), validationCore::isValid(), validationCore::parseCriteria(), and validationCore::validationStatus().
Show Source00217 {
00218
00219 zLogger::debug("Initializing Validation(GET/POST) System reading ".$map_file, 'rom.validation');
00220 $this->isValid = false;
00221 $this->parseCriteria($map_file);
00222 $this->isValid = $this->isValid();
00223 foreach($this->rules as $field_name => $rules){
00224 $field_name = str_replace(' ', '_', $field_name);
00225 $errText = $this->errtext($field_name);
00226 $this->{$field_name} = &new zRom_fields($this->items[$field_name], $errText, $this->isValid($field_name), $this->validationStatus($field_name));
00227 $validString = ($this->isValid($field_name)) ? "Valid" : "InValid";
00228 zLogger::debug("Storing Form Field: $field_name Value:$field_name as $validString ErrText: ".$errText, 'rom.Validation');
00229
00230 }
00231 }
Top
zRom_form::valueOf( string $fieldName, boolean $strict = false
)
Returns the value of a Form Field Name.
You can access get request parameters using $_GET/$_POST. However items/$_GET/$_POST is an associative array. If your error level is E_NOTICE PHP will fire Notice if you try to use items['someNonExistingField'] It will say index doesn't exist or similar Notice message. valueOf('fieldName') will also return value of that form field But if the form field doesn't exists it returns "" e.g. an empty string or false(if $strict is set to true) So PHP will not fire any Error message.
- Parameters:
-
| $fieldName | Name of teh form Field thats value you want to retrive |
| $strict | if set to true returns boolean false if the form field doesn't exists |
- Returns:
- mixed
Definition at line 245 of file map.php.
Show Source00245 {
00246 return isset($this->items[$fieldName]) ? $this->items[$fieldName] : ($strict ? false : "");
00247 }
Top
zRom_form::isSubmitted( )
Checks wheather or not form has been submitted.
Returns boolean value wheather or not the form has been submitted. e.g. true if the form has been submitted else false
- Returns:
- boolean
Definition at line 255 of file map.php.
Show Source00255 {
00256 return $this->is_submited;
00257 }
Top
Field Documentation
zRom_form::$items = array()
zRom_form::$isValid = true
zRom_form::$is_submited = false
The documentation for this class was generated from the following file: