Hi,

I am currently trying to make an extensible form template, that could
satisfy a wide range of typical use cases when building a prototype
with sfForms 1.1.

One of my most-wanted functionnality is to automatically display a
picture when I'm editing, above each form element which is an input
file. This will be clearer with an example:

<?php foreach ($form->getFormFieldSchema() as $formField):?>

        <?php if ($formField->isHidden()):?>
                <?php echo $formField->render();?>
                <?php continue;?>
        <?php endif;?>

    <tr>
      <th><?php echo $formField->renderLabel()?></th>
      <td>
                <?php if ($formField->hasError()):?>
                <?php echo $formField->renderError() ?>
                <?php endif;?>

                <?php if ($formField->getWidget() instanceof 
sfWidgetFormInputFile
&& !$form->getObject()->isNew()):?>
                        <?php echo image_tag($form->getObject()-
>{'get'.sfInflector::camelize($formField->name.'_url')}())?><br />
                <?php endif;?>

        <?php echo $formField->render(); ?>
      </td>
    </tr>
<?php endforeach;?>

Like that, I'll just have to build a custom method like getImageUrl to
display the right path to the element.

The problem is, $formField->name is a protected asset, with no way to
access it outside the class (not even through the widget). I could
extend the core class, but I think it would be more useful to the
community if you added a simple getName() accessor to the sfFormField
class.

Thanks in advance,
Cedric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to