Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 968313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:27:31+00:00 2026-05-16T02:27:31+00:00

I am using Symfony 1.3.6 on Ubuntu 10.0.4. I am using the sfWidgetFormSelectRadio to

  • 0

I am using Symfony 1.3.6 on Ubuntu 10.0.4.

I am using the sfWidgetFormSelectRadio to allow a user to select a picture from a list, in a form.

In the action, the pictures are set up like this:

    $this->form->setWidget('chosenpic', new sfWidgetFormSelectRadio(array(
                            'choices' => $this->pictures,
                            'default' => $this->pictures[count($this->pictures)-1] ))
                            );

In the template, the widget is displayed like this:

<?php echo $form['chosenpic']->render(array('id'=>'check'.($i+1), 'value'=> ($i+1), 'width' => "80", 'height' => "80")); ?>

This generates the following output:

<ul class="radio_list"><li><input type="radio" width="80" height="80" id="check1" value="1" name="flowers[chosenpic]">&nbsp;<label for="flowers_chosenpic_0">http://example.com/media/images/48408000/jpg/_48408794_009829449-1.jpg</label></li></ul>

I do no want the the label for appearing, as it messes up the form. Short of manually generating the HTML myself (using the form and widget names, is there a way that I can prevent the widget from displaying a ‘label for’ ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:27:32+00:00Added an answer on May 16, 2026 at 2:27 am

    You need to provide a custom formatter. In your form’s configure function, do the following:

    public function configure()
    {
      $this->setWidget('chosenpic', new sfWidgetFormSelectRadio(array(
            'formatter' => array($this, 'pictureRadioFormatterCallback')
      )));
    }
    

    Then, add a formatter that doesn’t render labels to your form:

    public function pictureRadioFormatterCallback($widget, $inputs)
    {
      $rows = array();
      foreach ($inputs as $input)
      {
        $rows[] = $widget->renderContentTag('li', $input['input']);
      }
    
      return !$rows ? 
        '' : 
        $widget->renderContentTag('ul', implode($widget->getOption('separator'), $rows), array('class' => $widget->getOption('class')));
    }
    

    However, ideally, you should be using the labels to display the images, rather than displaying the images outside of the labels. Also, it’s typically a bad idea to be configuring widgets inside of an action, can that code go in it’s own form?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Symfony 1.4. I'm posting a form via Jquery ajax to an action
I am using Symfony 1.3.2 on Ubuntu 9.10 I want to set the default
Using Symfony and Doctrine, I have a multi-select list box. The multiple default values
I am using symfony 1.0.6 and in action file we can set error using,
I am currently using symfony 1.4 and would like to allow users to upload
I'm using Symfony 2.1-dev and am having problems when authenticate users using a form.
I am using symfony 1.0 and have set routing for few URLs as below.
I'm using symfony with doctrine and I make a registration form. Email field is
I am using Symfony 1.3.2 on Ubuntu. I have written a little helper function
I am trying to set up symfony on my Ubuntu system. Now as going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.