|
10 | 10 | use Ajax\semantic\html\elements\HtmlDivider; |
11 | 11 | use Ajax\JsUtils; |
12 | 12 | use Ajax\semantic\html\collections\form\traits\FormTrait; |
| 13 | +use Ajax\semantic\components\Form; |
13 | 14 |
|
14 | 15 | /** |
15 | 16 | * Semantic Form component |
@@ -151,24 +152,26 @@ public function compile(JsUtils $js=NULL,&$view=NULL){ |
151 | 152 | } |
152 | 153 |
|
153 | 154 | public function run(JsUtils $js) { |
154 | | - $compo=NULL; |
| 155 | + if(isset($js)){ |
| 156 | + $compo=$js->semantic()->form("#".$this->identifier); |
| 157 | + }else{ |
| 158 | + $compo=new Form(); |
| 159 | + $compo->attach("#".$this->identifier); |
| 160 | + } |
155 | 161 | foreach ($this->_fields as $field){ |
156 | 162 | if($field instanceof HtmlFormField){ |
157 | | - $compo=$this->addCompoValidation($js, $compo, $field); |
| 163 | + $compo=$this->addCompoValidation($compo, $field); |
158 | 164 | } |
159 | 165 | } |
160 | 166 | foreach ($this->content as $field){ |
161 | 167 | if($field instanceof HtmlFormFields){ |
162 | 168 | $items=$field->getItems(); |
163 | 169 | foreach ($items as $_field){ |
164 | 170 | if($_field instanceof HtmlFormField) |
165 | | - $compo=$this->addCompoValidation($js, $compo, $_field); |
| 171 | + $compo=$this->addCompoValidation($compo, $_field); |
166 | 172 | } |
167 | 173 | } |
168 | 174 | } |
169 | | - if(isset($compo)===false){ |
170 | | - return parent::run($js); |
171 | | - } |
172 | 175 | $this->_runValidationParams($compo,$js); |
173 | 176 | return $this->_bsComponent; |
174 | 177 | } |
|
0 commit comments