Hello,
I have a richfaces colorPicker component where I set the onchange attribute. The goal is to call a client-side javascript function after the color has chnaged and get the new color value. I have the component defined like:
<rich:colorPicker colorMode="hex" id="draw_line_cp" onchange="changeColor(this)" value="#28872b"/>
After the page is rendered, the resulting source for this includes:
<span class="rich-color-picker-span" id="mapform:draw_line_cp"><input name="mapform:draw_line_cp" readonly="readonly" value="#28872b" type="text">
The "this" value in the function call equates to the ID of the <span> tag, not the text field that holds the color value. Since the text field with the color value only has a "name" attribute, I tried to get the field object by document.mapform.mapform:draw_line_cp. As you can imagine, browsers do like like syntax (the colon).
So, now I am stuck trying to figure out how I can get the newly picked color value in my javascript call from an onchange. All the examples for the colorPicker I find use the <a4j:spport> to send the value to the server. This is not the behavior I need to implement. Does anyone know how I can get the colorPickers color on an onchange call?
Thanks - Peter