I am trying to add jscolor to an input field but it is not working with me!
In configure function:
public function configure() {
unset($this['created_at'],$this['clicks']);
$this->widgetSchema['background_color']->sfWidgetFormInput('class'=> 'jscolor');
}
I also tried adding the below in BaseForm:
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'background_color' => new sfWidgetFormInput(array('class'=> 'jscolor')),
'url_link' => new sfWidgetFormInput(),
'status' => new sfWidgetFormInput(),
));
Error: Class is not allowed in the sfWidgetFormInput function !
I want to add a class jscolor! How can i add it via JavaScript or using this configuration?
You need to add your class to your input during rendering the form element in your template as :
<?php echo $form['background_color']->render(array('class' => 'jscolor')); ?>