Revision 8a197e58
Added by Thane Gill about 10 years ago
usr/local/www/classes/Form.class.php | ||
---|---|---|
37 | 37 |
protected $_sections = array(); |
38 | 38 |
protected $_global = array(); |
39 | 39 |
protected $_labelWidth = 2; |
40 |
// Empty is interpreted by all browsers to submit to the current URI |
|
41 |
protected $_action; |
|
42 | 40 |
|
43 | 41 |
public function __construct() |
44 | 42 |
{ |
43 |
$this->addClass('form-horizontal'); |
|
44 |
$this->setAttribute('method', 'post'); |
|
45 |
|
|
45 | 46 |
$this->addGlobal(new Form_Button( |
46 | 47 |
'save', |
47 | 48 |
'Save' |
48 | 49 |
)); |
50 |
|
|
51 |
return $this; |
|
49 | 52 |
} |
50 | 53 |
|
51 | 54 |
public function add(Form_Section $section) |
... | ... | |
66 | 69 |
|
67 | 70 |
public function setAction($uri) |
68 | 71 |
{ |
69 |
$this->_action = $uri; |
|
72 |
$this->setAttribute('action', $uri); |
|
73 |
|
|
74 |
return $this; |
|
70 | 75 |
} |
71 | 76 |
|
72 | 77 |
public function getLabelWidth() |
... | ... | |
100 | 105 |
$html .= implode('', $this->_global); |
101 | 106 |
|
102 | 107 |
return <<<EOT |
103 |
<form class="form-horizontal" action="{$this->_action}" method="post">
|
|
108 |
<form {$this->getHtmlAttribute()}>
|
|
104 | 109 |
{$html} |
105 | 110 |
</form> |
106 | 111 |
EOT; |
107 | 112 |
} |
108 |
} |
|
113 |
} |
Also available in: Unified diff
Move attribute to Form_Element
- Removes redundant code
- Adds the ability to remove attributes
- Can now add attributes to Form
- getHtmlAttribute() returns all attributes including class
Conflicts:
usr/local/www/classes/Form/Button.class.php
usr/local/www/classes/Form/Select.class.php