@@ -156,9 +156,9 @@ public function fieldAsAvatar($index,$attributes=NULL){
156156 }
157157
158158 public function fieldAsRadio ($ index ,$ attributes =NULL ){
159- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ){
159+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ) use ( $ attributes ) {
160160 $ input = new HtmlRadio ($ id ,$ name ,$ value ,$ value );
161- return $ input ;
161+ return $ this -> _prepareFormFields ( $ input, $ name , $ attributes ) ;
162162 }, $ index ,$ attributes ,"radio " );
163163 }
164164
@@ -176,10 +176,9 @@ public function fieldAsInput($index,$attributes=NULL){
176176 }
177177
178178 public function fieldAsTextarea ($ index ,$ attributes =NULL ){
179- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ){
179+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ( $ attributes ) {
180180 $ textarea =new HtmlFormTextarea ($ id ,$ caption ,$ value );
181- $ textarea ->setName ($ name );
182- return $ textarea ;
181+ return $ this ->_prepareFormFields ($ textarea , $ name , $ attributes );
183182 }, $ index ,$ attributes ,"textarea " );
184183 }
185184
@@ -192,19 +191,18 @@ public function fieldAsHidden($index,$attributes=NULL){
192191 }
193192
194193 public function fieldAsCheckbox ($ index ,$ attributes =NULL ){
195- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ){
194+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ( $ attributes ) {
196195 $ input =new HtmlFormCheckbox ($ id ,$ caption ,$ this ->_instanceViewer ->getIdentifier ());
197196 $ input ->setChecked (JString::isBooleanTrue ($ value ));
198- $ input ->setName ($ name );
199- return $ input ;
197+ return $ this ->_prepareFormFields ($ input , $ name , $ attributes );
200198 }, $ index ,$ attributes ,"ck " );
201199 }
202200
203201 public function fieldAsDropDown ($ index ,$ elements =[],$ multiple =false ,$ attributes =NULL ){
204- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ($ elements ,$ multiple ){
202+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ($ elements ,$ multiple, $ attributes ){
205203 $ dd =new HtmlFormDropdown ($ id ,$ elements ,$ caption ,$ value );
206204 $ dd ->asSelect ($ name ,$ multiple );
207- return $ dd ;
205+ return $ this -> _prepareFormFields ( $ dd , $ name , $ attributes ) ;
208206 }, $ index ,$ attributes ,"dd " );
209207 }
210208
0 commit comments