You should read this part of the documentation :
http://www.symfony-project.org/book/forms/1_2/en/02-Form-Validation#Global%20Validators

On Tue, Dec 2, 2008 at 9:57 PM, Fabrice B <[EMAIL PROTECTED]>wrote:

>
> I have created such a widget, to be soon included in the
> sfEasyGMapPlugin
>
> My way to include it inside a form was the following :
>
> I unsetted the latitude and longitude fields in the configure of the
> form (i have a few other ones too : geo_accuracy, normalized_address,
> normalized_country_code, normalized_postal_code, corresponding to the
> geographical information data sent by Google when using the xml
> geocoding service)
>
> class MappableObjectForm extends BaseMappableObjectForm
> {
>  protected $gmappable_fields =
>      array(
>        'latitude',
>        'longitude',
>        'geoaccuracy',
>        'normalized_address',
>        'normalized_city',
>        'normalized_postal_code',
>        'normalized_country_code'
>      );
>
>  public function configure()
>  {
>    foreach($this->gmappable_fields as $gmappable_field)
>    {
>      unset($this->widgetSchema[$gmappable_field]);
>    }
>    $this->widgetSchema['gmappable'] = new sfWidgetFormGMappable();
>  }
>
>  public function bind(array $taintedValues = null, array
> $taintedFiles = null)
>  {
>    $gmappable = $taintedValues['gmappable'];
>    foreach($gmappable as $field => $value)
>    {
>      $taintedValues[$field] = $value;
>    }
>    unset($taintedValues['gmappable']);
>
>    parent::bind($taintedValues,$taintedFiles);
>  }
>
> I did that a little time ago, and now I have more experience with
> forms, so I think this is not the optimal solution
> 1. I don't use validators for the gmappable fields. BAD
> 2. I am sure there is a way to embed widgets inside widgets. That
> would it more beautiful AND solve solution 1 at the same time...
>
> Can anybody suggest me some help on widgets containing subwidgets, if
> that actually exists ?
>
> Fabrice Bernhard
> --
> http://www.allomatch.com
>
>
> On Nov 26, 2:26 pm, melchior <[EMAIL PROTECTED]> wrote:
> > hi,
> > i have a Person Object that could be geolocated and then have to
> > properties 'latitude' and 'longitude',
> > i want in admin edit form a widget that replace the  2 input fields by
> > a widget that display a Google maps
> > and by moving the marker updating coordinates
> > i have try to make a new widget that display a  the make that was
> > simple
> > i have make 2 hidden fields that are updated when moving the marker on
> > the map.
> >
> > but i have some trouble with the hidden fieldname.
> >
> > in the form all fields name are formated with person[%s] string but
> > the 2 hidden fields aren't, they call latitude and longitude, because
> > in the widget we can't access the formatName value
> >
> > a search a nice way to generate the right name for the both field
> > (corresponding to the both properties oh the object), or a way to give
> > to the widget the ID of the both original field.
> >
>


-- 
Thomas Rabaix
Internet Consultant

--~--~---------~--~----~------------~-------~--~----~
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