Jump to content

How to add color picker in by using helper form


Recommended Posts

Hi ,

 

I am trying to add a color picker field in my module by using form helper. But it is not working, I think I am doing something wrong. Here is my code:

array(
   'type' => 'color',
   'label' => $this->l('Color'),
   'name' => 'THEME_BG_COLOR'						
),	

The code generated on the browser is 

<div class="input-group">
    <input type="color" data-hex="true" class="color mColorPickerInput" name="THEME_BG_COLOR" value="#344545">
</div>

When I change the color it does not reflect in value field. What am i missing here?

post-651073-0-52394100-1415876932_thumb.png

Link to comment
Share on other sites

I have checked that in AdminStatusesController they are also using 

array(
	'type' => 'color',
	'label' => $this->l('Color'),
	'name' => 'TK_THEME_BG_COLOR'						
),

But when I am using this it is not working.  It is acting as default html5 input type color as shown in attachment.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

I have checked that in AdminStatusesController they are also using 

array(
	'type' => 'color',
	'label' => $this->l('Color'),
	'name' => 'TK_THEME_BG_COLOR'						
),

But when I am using this it is not working.  It is acting as default html5 input type color as shown in attachment.

the color picker jquery plugin needs older version of jQuery. With version 3.1.1 it was not working.
 
I tested it with jQuery 2.0.0 and it works. You can set it at bottom of file /config/defines.inc.php
 
if (!defined('_PS_JQUERY_VERSION_')) {
    define('_PS_JQUERY_VERSION_', '2.0.0');
}
Link to comment
Share on other sites

×
×
  • Create New...