@@ -164,8 +164,8 @@ public function fieldAsInput($index,$attributes=NULL){
164164 }
165165
166166 public function fieldAsTextarea ($ index ,$ attributes =NULL ){
167- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ){
168- $ textarea =new HtmlFormTextarea ($ id ,null ,$ value );
167+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value, $ caption ){
168+ $ textarea =new HtmlFormTextarea ($ id ,$ caption ,$ value );
169169 $ textarea ->setName ($ name );
170170 return $ textarea ;
171171 }, $ index ,$ attributes ,"textarea " );
@@ -180,17 +180,17 @@ public function fieldAsHidden($index,$attributes=NULL){
180180 }
181181
182182 public function fieldAsCheckbox ($ index ,$ attributes =NULL ){
183- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ){
184- $ input =new HtmlFormCheckbox ($ id ,NULL ,$ this ->_instanceViewer ->getIdentifier ());
183+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value, $ caption ){
184+ $ input =new HtmlFormCheckbox ($ id ,$ caption ,$ this ->_instanceViewer ->getIdentifier ());
185185 $ input ->setChecked (JString::isBooleanTrue ($ value ));
186186 $ input ->setName ($ name );
187187 return $ input ;
188188 }, $ index ,$ attributes ,"ck " );
189189 }
190190
191191 public function fieldAsDropDown ($ index ,$ elements =[],$ multiple =false ,$ attributes =NULL ){
192- return $ this ->_fieldAs (function ($ id ,$ name ,$ value ) use ($ elements ,$ multiple ){
193- $ dd =new HtmlFormDropdown ($ id ,$ elements ,NULL ,$ value );
192+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value, $ caption ) use ($ elements ,$ multiple ){
193+ $ dd =new HtmlFormDropdown ($ id ,$ elements ,$ caption ,$ value );
194194 $ dd ->asSelect ($ name ,$ multiple );
195195 return $ dd ;
196196 }, $ index ,$ attributes ,"dd " );
@@ -238,8 +238,15 @@ public function fieldAs($index,$type,$attributes=NULL){
238238 public function fieldAsSubmit ($ index ,$ cssStyle =NULL ,$ url =NULL ,$ responseElement =NULL ,$ attributes =NULL ){
239239 return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ($ url ,$ responseElement ,$ cssStyle ,$ attributes ){
240240 $ button =new HtmlButton ($ id ,$ value ,$ cssStyle );
241- $ this ->_buttonAsSubmit ($ button ,"click " ,$ url ,$ responseElement ,$ attributes ["ajax " ]);
241+ $ this ->_buttonAsSubmit ($ button ,"click " ,$ url ,$ responseElement ,@ $ attributes ["ajax " ]);
242242 return $ button ;
243243 }, $ index ,$ attributes ,"submit " );
244244 }
245+
246+ public function fieldAsButton ($ index ,$ cssStyle =NULL ,$ attributes =NULL ){
247+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ($ cssStyle ){
248+ $ button =new HtmlButton ($ id ,$ value ,$ cssStyle );
249+ return $ button ;
250+ }, $ index ,$ attributes ,"button " );
251+ }
245252}
0 commit comments