i have a form widget in _form.php

echo $form['catcher_id']->renderLabel();  //the label
echo $form['catcher_id']->renderError();  //the validator

symfony created the base class:
<?php
/**
 * LpmService form base class.
 *
abstract class BaseLpmServiceForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'name'                 => new sfWidgetFormInputText(),
      'wap_home'             => new sfWidgetFormInputText(),
      'call_center_number'   => new sfWidgetFormInputText(),
     [color=#FF4000] 'catcher_id'           => new
sfWidgetFormPropelChoice(array('model' => 'LpmCatcher', 'add_empty' =>
false)),[/color]
      'price_description'    => new sfWidgetFormInputText(),
      'logo'                 => new sfWidgetFormInputText(),
      'invalid_msisdn_text'  => new sfWidgetFormInputText(),
      'terms_and_conditions' => new sfWidgetFormInputText(),
      'service_code'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices'
=> array($this->getObject()->getId()), 'empty_value' => $this-
>getObject()->getId(), 'required' => false)),
      'name'                 => new
sfValidatorString(array('max_length' => 64, 'required' => false)),
      'wap_home'             => new
sfValidatorString(array('max_length' => 256, 'required' => false)),
      'call_center_number'   => new
sfValidatorString(array('max_length' => 13, 'required' => false)),
      'catcher_id'           => new
sfValidatorPropelChoice(array('model' => 'LpmCatcher', 'column' =>
'id')),
      'price_description'    => new
sfValidatorString(array('max_length' => 128, 'required' => false)),
      'logo'                 => new
sfValidatorString(array('max_length' => 255, 'required' => false)),
      'invalid_msisdn_text'  => new
sfValidatorString(array('max_length' => 255, 'required' => false)),
      'terms_and_conditions' => new
sfValidatorString(array('max_length' => 750, 'required' => false)),
      'service_code'         => new
sfValidatorString(array('max_length' => 3, 'required' => false)),
    ));
    $this->widgetSchema->setNameFormat('lpm_service[%s]');
    $this->errorSchema = new sfValidatorErrorSchema($this-
>validatorSchema);
    parent::setup();
  }
  public function getModelName()
  {
    return 'LpmService';
  }
}

and i re-created the dropdown list manually so i can incorporate a
"onchange" event:
 <select name="services" onchange="refreshPage(this.form.services)"
id="droplist">
           <?php
              $catcher_names = LpmCatcherPeer::getByAllNames();
              foreach($catcher_names as $row)
              {
                  ?>
                    <option value="<?php echo $row->getName()."/".$row-
>getId(); ?>" <?php
                      if($row->getName() == $catcher_name) echo
'selected="selected"'?>><?php echo $row->getName();?></option>
                    <?php
              }
                  ?>
            </select>
how can i assign a value to echo $form['catcher_id'] because now when
i select a value from the dropdown and click submit the validator says
that catcher_id is required(because i created dropdown manually), so
how can i set the value manually???

i have: $form['catcher_id']->getWidget()->setAttribute('value', '11');
BUT IT IS NOT working!! please help???????
thank you

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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