Unfortunately Your solution doesn't work :/

On 29 Gru, 08:16, James Cauwelier <james.cauwel...@gmail.com> wrote:
> Well, I wouldn 't use the remote function since it 's deprecated.  And
> yes, you could use the form framework for this.
>
> The 'normal way' of constructing a symfony form is to build your
> widget schema using the configure () method and nothing prevents you
> to put a loop in that method.  If this behavior is going to be used in
> multiple locations, you could even subclass sfForm to package only
> this behavior.
>
> I 've only been using sf1.2+ recently, so there might be another
> (better) way of doing this.  I 'v also seen sfWidgetFormSchemaForEach
> () in the API documentation which might be what you 're looking for
> judging by it 's name, but I haven't studied the API docs.
>
> Something like this could work:
>
> $form = new CommentApprovalForm;
> // set id 's of comments in the form and reconfigure
> $form->setCommentValues (array(1,2,54,10));
> $form->configure();
>
> // In your template
> foreach ($form as $form_field){
>   $form_field->renderRow();
>
> }
>
> // your form class configure method
> public function configure () {
>   ...
>   foreach ($this->comment_values as $comment_value) {
>     $this->addWidget(...);
>   }
>   ...
>
> }
>
> On Dec 28, 9:42 am, dziobacz <aaabbbcccda...@gmail.com> wrote:
>
> > I would like to approve comments clicking on checkboxes using AJAX
> > (without refreshing page).
> > Screen is here:http://forum.symfony-project.org/index.php/t/24537/
> > So as you can see above now I have checkboxes - each checkbox is a one
> > row from table - so I must write in view:
>
> > <form>
> > <?php
> >         foreach($comments as $c)
> >         {
> >                 echo "<input type='checkbox' name='comment' 
> > value='".$c->getId
> > ()."'";
> >                 if($c->getApproved() == 1) echo "checked='checked'";
> >                 echo " />";
> >                 echo $c->getComment();
> >         }
> > ?>
> > </form>
>
> > Is it the best solution ? Maybe I should create this form using
> > Symfony forms in catalog /form ? But in that case I will have to pass
> > $this->comments to Symfony form  and then create one checkbox per one
> > row using loop, so I don't know if it is possible in Symfony forms and
> > I don't know if I should in that case using Symfony forms ?
>
>

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to