This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » symfony 1.3 and 1.4 » Setting id_format has no effect
Setting id_format has no effect [message #103034] Sat, 24 July 2010 17:10 Go to next message
ReeD  is currently offline ReeD
Messages: 131
Registered: March 2007
Senior Member

It seems that setting the "id_format" option for widgets has no effect.

Here's a short example:

class SampleForm extends sfForm {
    public function configure() {
        $this->widgetSchema['test'] = new sfWidgetFormInputText();
        $this->widgetSchema['test']->setOption('id_format', '%s_suffix');

$f = new SampleForm(); 
echo $f->getWidget('test')->getOption('id_format')."\n";
echo $f;


  <th><label for="test">Test</label></th>
  <td><input type="text" name="test" id="test" /><input type="hidden" name="_csrf_token" value="x" id="csrf_token" /></td>

The expected id is "test_suffix" but it's set to "test" as if the format was never changed. Is it intended or is it a bug?
Re: Setting id_format has no effect [message #103097 is a reply to message #103034 ] Mon, 26 July 2010 17:51 Go to previous message
claudia_k  is currently offline claudia_k
Messages: 29
Registered: June 2010
Junior Member
I have the same problem (symfony 1.4.6). I tracked it down to these lines of codes:
// we clone the widget because we want to change the id format temporarily
$clone = clone $widget;

( get/sfWidgetFormSchema.class.php#L507)

which is where the custom id_format is overwritten. Since I was just testing something that I did not really need I did not follow up on that problem.

So I would say it is a bug but the comment in the code indicates that it is done on purpose - I don't know why.

Previous Topic:sfWidgetFormDoctrineChoice return value
Next Topic:Admin Generator - batch action question
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software