partial field validation in admin gen 

http://www.symfony-project.org/forum/index.php?t=msg&goto=11456&#msg_11456

here is an excerpt of my code.

Example 1. My edit.yml file:

methods:
  post:
   - "organisation{raison_sociale}"
   - "organisation{sigle}"
   - "organisation{_adresse}"

names:
  organisation{raison_sociale}:
    required:     Yes
    required_msg: La raison sociale doit obligatoirement ...
    validators:   raisonSocialeValidator
  organisation{sigle}:
    required:     Yes
    required_msg: Le sigle doit obligatoirement ...
organisation{_adresse}:
    required:     Yes
    required_msg: L'adresse de l'organisation doit obligatoirement ...

raisonSocialeValidator:
  class:          sfStringValidator
  param:
    min:          2
    min_error:    Vous n'avez pas entr...

fillin:
  activate: on

Example 2. My generator.yml file:

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      Organisation
    theme:            default

    list:
      title:          Liste des entreprises
      layout:         tabular


    edit:
      title:          .../Modification d'une Entreprise
      actions:
        _list:                  -
        _save_and_add:  -
        _delete:                -
      display:
        "Informations ...":       [raison_sociale, sigle]
        "Coordonn...":                  [_adresse]
      fields:
        raison_sociale:         { name: Raison Sociale }
        sigle:                  { name: Sigle }
        adresse:                { name: Adresse }

Example 3. My _adresse.php template:

<?php  echo form_error('adresse');
echo textarea_tag('adresse','','size=40x4')?>

then override of updateOrganisationFromRequest() (in order to fill the adress table):

protected function updateOrganisationFromRequest()
{
$adresse= new Adresse();
$adresse->setAdresseLigne1($this->getRequestParameter('adresse'));    $adresse->setCpVilleIdcpVille($this->getRequestParameter('CP'));
$adresse->save();
$this->getRequest()->setAttribute('idAdresse', $adresse->getIdadresse());
parent::updateOrganisationFromRequest();
}

documented on: 05 September 2006, nikko

partial field validation in admin gen 

The name in the validation file corresponds to the field name in the template. If, in your template, the field is named 'adresse', then you must write in your validation file:

adresse:
  required: Yes
  required_msg: L'adresse de l'organisation doit obligatoirement...

documented on: 11 September 2006, francois