@@ -46,13 +46,20 @@ protected function _generateContent($form){
4646 $ values = $ this ->_instanceViewer ->getValues ();
4747 $ count =$ this ->_instanceViewer ->count ();
4848 $ separators =$ this ->_instanceViewer ->getSeparators ();
49- $ separators []=$ count ;
50- for ($ i =0 ;$ i <\sizeof ($ separators )-1 ;$ i ++){
51- $ fields =\array_slice ($ values , $ separators [$ i ]+1 ,$ separators [$ i +1 ]-$ separators [$ i ]);
52- if (\sizeof ($ fields )===1 ){
53- $ form ->addField ($ fields [0 ]);
54- }else
55- $ form ->addFields ($ fields );
49+ $ size =\sizeof ($ separators );
50+ if ($ size ===1 ){
51+ foreach ($ values as $ v ){
52+ $ form ->addField ($ v );
53+ }
54+ }else {
55+ $ separators []=$ count ;
56+ for ($ i =0 ;$ i <$ size -1 ;$ i ++){
57+ $ fields =\array_slice ($ values , $ separators [$ i ]+1 ,$ separators [$ i +1 ]-$ separators [$ i ]);
58+ if (\sizeof ($ fields )===1 ){
59+ $ form ->addField ($ fields [0 ]);
60+ }else
61+ $ form ->addFields ($ fields );
62+ }
5663 }
5764 }
5865
@@ -91,6 +98,14 @@ public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=N
9198 }, $ index ,$ attributes );
9299 }
93100
101+ public function fieldAsReset ($ index ,$ cssStyle =NULL ,$ attributes =NULL ){
102+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ) use ($ cssStyle ){
103+ $ button =new HtmlButton ($ id ,$ value ,$ cssStyle );
104+ $ button ->setProperty ("type " , "reset " );
105+ return $ button ;
106+ }, $ index ,$ attributes );
107+ }
108+
94109 /**
95110 * {@inheritDoc}
96111 * @see \Ajax\common\Widget::getHtmlComponent()
0 commit comments