Symfony 1.1 Form: Urgently Needed


Eveybody like symfony 1.1 form, but there are several fatures of symfony 1.0 forms which are not yet available under symfony 1.1.
The missing widgets in symfony 1.1 which all peoples should have, are rich textarea, rich input date time, and so on.
Looking up at the form helper code, I decided to make it available for symfony 1.1. The sfFormAddonsPlugin provide some widgets:

  1. sfWidgetFormRichTextarea (currently only support TinyMCE).
    Example usage:

    $this->widgetSchema['content'] = new sfWidgetFormRichTextarea(array(
      'textarea' => array('rows' => 10, 'cols' => 60),
      'editor'   => array(
        'tinymce_options' => array(
          'content_css'             => '/css/tinymce.css',
          'plugins'                 => 'advimage,advlink,flash',
          'theme_advanced_buttons1' => 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,image,|,cleanup,removeformat,hr,|,code',
          'theme_advanced_buttons2' => '',
          'theme_advanced_buttons3' => '',
        )
      )
    ));
  2. sfWidgetFormInputCalendar (input_date_tag() with ‘rich’ => true option, using Calendar). This widget must be paired with sfValidatorDateAdvanced.
    Example usage:

    $this->widgetSchema['created_at'] = new sfWidgetFormInputCalendar(array('with_time' => true));
    $this->validatorSchema['created_at'] = new sfValidatorDateAdvanced(array('with_time' => true));
  3. sfWidgetFormInputAutocomplete, using JQuery.
    Example usage:

    $this->widgetSchema['category_name'] = new sfWidgetFormInputAutocomplete(array('url' => '@weblog_category_completion'));
  4. sfWidgetFormChecklist. This widget must be paired with sfValidatorChoiceMany.
    Example usage:

    $choices = array(1 => 'One', 2 => 'Two', 3 => 'Three');
    $this->widgetSchema['choices'] = new sfWidgetFormChecklist(array('choices' => $choices));
    $this->validatorSchema['choices'] = new sfValidatorChoiceMany(array('choices' => array_keys($choices)));

Download: sfFormAddonsPlugin.zip

Advertisements

, ,

  1. #1 by Dan on November 28, 2008 - 2:02 pm

    nice plugin, but how do i install it?

  2. #2 by Dan on November 28, 2008 - 2:25 pm

    sorry man, found the solution. i’ve forgotten to enable the plugin in settings.yml :/

  3. #3 by Neuquino on March 29, 2009 - 2:36 am

    I found a bug in your plugin… the format attribute is not working in sfWidgetFormInputCalendar.

    you should change line 52:

    $pattern = $this->getOption(‘format’) ? $this->getOption(‘format’) : $withTime ? ‘g’ : ‘d’;

    With this one:

    $pattern = ($this->getOption(‘format’)) ? $this->getOption(‘format’) : ($withTime ? ‘g’ : ‘d’);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: