Add more widgets for sfForm framework
JavaScript PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
data
i18n
lib
modules/swFormPreview
test
web
.gitignore
.gitmodules
LICENSE
LICENSE.autocomplete
LICENSE.starrating
README.md
package.xml.tmpl

README.md

swFormExtraPlugin

Widgets

  • swWidgetFormDoctrineInputCheckboxGroup : represents a group of checkbox HTML tag for a model where you can select multiple values.
  • swWidgetFormDoctrineSelectNestedSet : display a select with the NestedSet structure
  • swWidgetFormDoctrineSelectNestedSetPosition : display a select with the NestedSet structure and a position options. Some portions are inspired from the isicsPropelNestedSetPositionPlugin
  • swWidgetFormGMapAddress : represents a gmap address widget
  • swWidgetFormInputCheckboxGroup : represents a group of checkbox HTML tag for a array/callback where you can select multiple values.
  • swWidgetFormJQueryMultiAutocompleter : represents an autocompleter input widget rendered by JQuery. This autocompleter can be use to display multiple values.
  • swWidgetFormRadio : represents one radio HTML tag
  • swWidgetFormTrilean : represents a select HTML tag : yes, no and null
  • swWidgetFormjQueryStarRating : a star rating widget
  • swWidgetFormUploadify : multiple uploads using flash from http://www.uploadify.com/

Validators

  • swValidatorDoctrineNestedSetValidator : validator for swWidgetFormDoctrineInputCheckboxGroup input
  • swValidatorDoctrineNestedSetValidatorPosition : validator for swWidgetFormDoctrineSelectNestedSetPosition input
  • swValidatorGMapAddress : validator for swValidatorGMapAddress input
  • swValidatorStupidCaptcha : stupid captcha validator input
  • swValidatorText : escape any non text input
  • swValidatorTextYaml : validate yaml text input
  • swValidatorTrilean : validator for swWidgetFormTrilean input
  • swValidatorHtmlPurifier : clean html with HTML Purifier (not provided)
  • swValidatorBlackListWords : raise an exception if a field contains black listed words
  • swValidatorUploadify : validate files sent from the swWidgetFormUploadify widget

swFormHelper::resetFormLabels

This method have a lot of feature :

  • reset the label translation
  • define the mandatory_format (optional)
  • define the error format (optional)
  • secure the string input by using a middle class to avoid XSS. (optional)

Inside a form :

[php]
swFormHelper::resetFormLabels(sfForm $this, array(
  // define settings for the label
  'prefix'                  => 'label_',
  'catalogue'               => 'catalogue',
  'mandatory_format'        => "%s <sup>*</sup>",

  // define setting for the error message
  'error_message_prefix'    => 'error_message_',
  'error_message_catalogue' => 'global_error_messages',
  'error_message_format'    => '<span class="error">%s</span>',

  // automatically escape input with the provided
  // validator_string_class settings, default is false
  'update_validator_string' => true | false,
  'validator_string_class'  => 'swValidatorText',
  'validator_options'       => array(
    'option_1' => 'value_1',
    'option_2' => 'value_2',
  ),
));

Some of the settings can be set globally in the app.yml

[yml]
all:
  swToolbox:
    form_mandatory_format: "%s <sup>*</sup>"
    form_error_message_prefix: "error_message_"
    form_error_message_catalogue: "error_messages"
    form_update_validator_string: on
    form_validator_string_class: swValidatorText
    form_validator_options:
      option_1: value_1
      option_2: value_2

Sample with parameters defined in the app.yml file. This allow to easily reuse your form inside a plugin.

[php]
class DemoForm extends BaseDemoForm
{

  public function configure()
  {

    // ... do other stuff
    swFormHelper::resetFormLabels($this, array(
      'catalogue'   =>'catalogue',
    ));
  }
}