Actually, this is a mistake in the generate-crud generated template.

It must generate something like this:

  <th><?php echo $form['lname']->renderLabel() ?></th>
  <td>
    <?php echo $form['lname']->renderError() ?>
    <?php echo $form['lname'] ?>
  </td>

It is now fixed in 1.1 and 1.2 (r11807 and r11808).

Sorry for the inconvenience.

Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.com | aide-de-camp.org
Tél: +33 1 40 99 80 80


Ant Cunningham wrote:
> Yeah I'm with you on that one. Actually, I like the idea of being able
> to add inheritance to forms (well widgets in general even though none
> of the others have been created yet) but as far as actual usage, the
> new form framework is a pain in the ass. Of course that may just be
> because Im not as familiar with the API as i should be yet.
> 
> On Sep 26, 11:19 am, "Jonathan Wage" <[EMAIL PROTECTED]> wrote:
>> I've wondered this myself. I always wanted it to generate with the call to
>> the form to get the label instead of hardcoding it.
>>
>> - Jon
>>
>> On Thu, Sep 25, 2008 at 11:02 AM, Ant Cunningham
>> <[EMAIL PROTECTED]>wrote:
>>
>>
>>
>>
>>
>>> Like i said this is because the default behavior for generate crud
>>> uses "verbose templates". This means that the labels are not rendered
>>> dynamically what is defined with setLabels(). Its statically coded
>>> into the template for example a from row in your template would look
>>> like this by default:
>>> <code>
>>> <tr>
>>>        <th><label for="floor_plan_price_range_id">Lname</label></th>
>>>        <td>
>>>          <?php echo $form['lname']->renderError() ?>
>>>          <?php echo $form['lname'] ?>
>>>        </td>
>>>      </tr>
>>> </code>
>>> The code above isnt going to render the dynamic label, its goign to
>>> render the label generated into the template. You need to change the
>>> template. Although, i would think that if you put the setLabel() calls
>>> in the configure method, and then generate the crud again, the
>>> templates will be generated with your modified labels... I could be
>>> wrong about that part though.
>>> On Sep 25, 11:27 am, Atif Khan <[EMAIL PROTECTED]> wrote:
>>>> I am using propel:generate-crud..etc and then propel:build-forms
>>>> Everything is working fine except I cannot seem to set the Lables.
>>>> I am able to change or setOptions, and change or set setAttributes, but
>>>> when I try
>>>> to setLabels it does not reflect at all.
>>>> what is the correct syntax.
>>>> is it
>>>> $this->widgetSchema->setLabel('lname', 'Last Name');
>>>> or
>>>> $this->widgetSchema['lname']->setLabel('lname', 'Last Name');
>>>> ??
>>>> class AccountsForm extends BaseAccountsForm
>>>> {
>>>>   public function configure()
>>>>   {
>>>>       // Schema
>>>>       $this->widgetSchema['active'] = new
>>>> sfWidgetFormSelect(array('choices' => AccountsPeer::getActives()));
>>>>       $this->widgetSchema['lname']->setAttributes(array('size' => '20'));
>>>>       $this->widgetSchema->setLabel('lname', 'Last Name');
>>>>       // Validators
>>>>       $this->validatorSchema['email'] = new sfValidatorEmail();
>>>>       $this->validatorSchema['lname']->setOption('required', true);
>>>>       $this->validatorSchema['lname']->setOption('min_length', 5);
>>>>   }
>>>> }
>>>> Ant Cunningham wrote:
>>>>> are you usingthe CRUD generator? i think the default output is verbose
>>>>> which means it doesnt just use 'echo $form' it actually writes out the
>>>>> view like <label for="my_form_element">My Label</label>
>>>>> So if this is the case youll have to manually go in and change all
>>>>> these. You can always generate the the shorter form with an option...
>>>>> check the help for generate:crud.
>>>>> Atif Khan wrote:
>>>>>> I am using propel Integration for my forms.
>>>>>> Where and how can I change the labels in the configure function
>>>>>> I tried
>>>>>> $this->widgetSchema->setLabel('lname', 'Last Name');
>>>>>> but it does not reflect on the page.
>>>>>> Thank you
>>>>>> Atif
>> --
>> Jonathan H. Wage
>> Open Source Software Developer & Evangelisthttp://www.jwage.com
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to