Skip to main content

Home/ foograde/ Group items tagged customize widgets

Rss Feed Group items tagged

Adán Muguiro

Modificando los widgets en la acción - 0 views

  • // in modules/foo/actions/actions.class.php // Define the form $this->form = new ContactForm();   // Add an empty option to the list of choices of a 'choice' widget $form->getWidget('language')->setOption('add_empty', 'Please choose a language'); // Add a 'gender' list of options widget $form->setWidget('gender', new sfWidgetFormChoice(array('expanded' => true, 'choices' => array('m' => 'Male', 'f' => 'Female')), array('class' => 'gender_list'))); // Change the HTML attributes of the 'subject' widget $form->getWidget('subject')->setAttribute('disabled', 'disabled'); // Remove the 'subject' field unset($form['subject']) // Note: You cannot remove just the widget. Removing a widget will also remove the related validators   // Change the 'min_length' error in the 'message' validator $form->getValidator('message')->setMessage('min_length', 'Message too short'); // Make the 'name' field optional $form->getValidator('name')->setOption('required', false);
  •  
    Varias cosas que se pueden modificar en los widgets desde la acción.
Adán Muguiro

Modificar template de los widgets - 0 views

  • $this->getWidgetSchema()->getFormFormatter()->setRowFormat('<div >%field%%help%%error%%hidden_fields%</div>');
  •  
    En caso de no querer poner los labels o cualquier otro componente de un widget por default.
1 - 2 of 2
Showing 20 items per page