예제 #1
0
파일: fxForm.php 프로젝트: netcarver/fxForm
 /**
  * Constructor for a form.
  *
  * Creates a named form with the given parameters.
  * Also sets the id of the form to "form-$name" (simplifying the contents of the $name in the process).
  * If this isn't what you want just overwrite the id by setting your own straight after the form is constructed and before you
  * call add() to put elements into your form.
  * This id of the form will be used as a prefix to the id of everything you then add to the form so there should be no collisions
  * between form-generated ids and ids you use elsewhere in your pages.
  **/
 public function __construct($name, $action, $method = "post")
 {
     fxAssert::isNonEmptyString($name, 'name', "Form must be named.");
     parent::__construct($name);
     $method_wl = array('post', 'get');
     $method = strtolower($method);
     fxAssert::isInArray($method, $method_wl);
     $this->_method = $method;
     $this->_action = $action;
     $this->id = self::_simplify("form-{$name}");
     $this->errors = array();
 }
예제 #2
0
 public function max($v)
 {
     fxAssert::isInArray($this->type, self::$numberTypes);
     $this->_data['max'] = $v;
     return $this;
 }