By johnhelen on
hello
I have a form with some input fields. I need to have a field that allow users to enter a hex value (of 6) to present color. Nearby is a button "preview". When I click preview, the color (presenting by this hex value) will be shown in a text area.
Of course, I also have a button "Save" for whole form.
Could you please have a suggestion for doing this... I am new with drupal
Thanks
john
Comments
This isn't really a drupal
This isn't really a drupal question but a JavaScript question. If you don't have any experience scripting then your probably gonna need to go do some JavaScript tutorials.
Ideally you want to "attach" an event like the onclick event to a css selector, the Behavior JS library makes this pretty easy. The event needs to fire a function that gets the value of your text box, check to see its a valid color value and then set some sort of preview element like a DIV's background color to the color value found in the text box.
Anyways, this isn't the kind of thing Drupal does for you although there may be some sort of widget module like the color picker that will provide a solid work around.
http://drupal.org/project/colorpicker
thank your for your great
thank your for your great suggestion