Welcome Guest Search | Active Topics | Sign In | Register

Clear colorpicker value from Javascript Options
PMB Tech
Posted: Wednesday, August 27, 2008 10:49:29 AM
Rank: Newbie
Groups: Member

Joined: 8/25/2008
Posts: 4
I am trying to clear the color from a color picker using javascript, but am not having any luck. I resorted to hard coding the colorpicker name:

function ClearBGColor(chk)
{
if (chk.checked)
{
var ctl = document.getElementById('ctl00_contentRight_DisplayText1_txtdataInfo_pickBackgroundColor');
ctl.clear();
}
}

But I get an 'Object dosen't support this method' when it calls the clear function.
How do I call colorpicker methods in javascript from a javascript function not associated with the colorpicker?

Thanks
eo_support
Posted: Wednesday, August 27, 2008 10:56:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

You certainly do not want to use getElementById. You will need to use eo_GetObject to return the ColorPicker object. Once you have the client side ColorPicker object, you can call clear method on it. So for you code, you'd basically replace "document.getElementById" with "eo_GetObject".

Thanks!
PMB Tech
Posted: Wednesday, August 27, 2008 11:46:19 AM
Rank: Newbie
Groups: Member

Joined: 8/25/2008
Posts: 4
Thank you, but now how do I get the textbox background to clear out as well? I tried both clear and setValue, but the textbox area still stays the same color. I put in an alert at the bottom of my routine and getValue returns blank, so I now the value is set correctly.
I need to set the popup selected box to clear also, so if the user opens the popup it is clear.
Basically I need everything to display based on the value I set the colorpicker to in javascript.
I'll be doing the same thing with White and Black to give the use a quick way to choose between White, Black or Transparent.
eo_support
Posted: Wednesday, August 27, 2008 11:58:16 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

The textbox is a regular input element and is not part of the ColorPicker. So I think you can do:

Code: JavaScript
document.getElementById("your_textbox_id").style.backgroundColor = "";


Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.