/** * 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(); }
public function __construct($name, $label, $members) { fxAssert::isArray($members, 'members') && fxAssert::isNotEmpty($members, 'members'); parent::__construct($name, $label); $this->_members = $members; $this->id = $tmp = fxForm::_simplify($name); $this->name = $tmp . '[]'; $this->_mmap = self::makeMemberMap($members); }