Results 1 to 7 of 7

Thread: yahoo Color Picker Help

  1. #1
    Join Date
    Dec 2006
    Location
    Under a Bridge
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default yahoo Color Picker Help

    1) Script Title: YUI Color Picker

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...cker/index.htm

    3) Describe problem:

    Hey guys,
    i am using this color selector and have come across a problem, if you use the color selector it fills a color box next to the text field, i would like it to fill 2 box's on the same page, but after i add another div with the same ID it doesn't load the second one as well, but if i delete the first one the second one starts working, is there a way i can make the 2 color box's work simultaneously?

    thanks for any help
    Last edited by baleric; 12-04-2006 at 12:05 PM.

  2. #2
    Join Date
    Dec 2006
    Location
    Under a Bridge
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    can anyone help?

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Well, the line within ddcolorposter.js that actually populates the text field with the color value is this:

    Code:
    this.targetobj.value=this.hexvalue //set field to selected hex color value
    Try changing that to:

    Code:
    this.targetobj.value=this.hexvalue //set field to selected hex color value
    document.getElementById("anotherfield").value=this.hexvalue
    where "anotherfield" is the ID of the other text field box. I haven't tested this out yet, though it should work.

  4. #4
    Join Date
    Dec 2006
    Location
    Under a Bridge
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks ddadmin,
    but that loads the values into another text field, what i want to do is make a preview of the colors 2 times on the same page... so the colorbox that changes colors to the right hand side of the text field still changes aswell as another colorbox...

    so i get 2 previews of the color from the one text fields value.]

    hope you understand

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah. You'll need some more extensive changes then. Replace the original ddcolorposter.js file with the attached instead. This modified one supports changing two color boxes to reflect the currently selected color, instead of the default one. On your page then, instead of calling:

    Code:
    ddcolorposter.fillcolorbox("colorfield1", "colorbox1", "colorbox2") //PREFILL "colorbox1" with hex value from "colorfield1"
    You'd call:

    Code:
    ddcolorposter.fillcolorbox("colorfield1", "colorbox1", "colorbox2") //PREFILL "colorbox1" with hex value from "colorfield1"
    and instead of the code:

    Code:
    <form>
    # <input type="text" id="colorfield1" onFocus="ddcolorposter.echocolor(this, 'colorbox1')"> <span id="colorbox1" class="colorbox">____</span> <br />
    </form>
    You'd have something like:

    Code:
    <form>
    # <input type="text" id="colorfield1" onFocus="ddcolorposter.echocolor(this, 'colorbox1', 'colorbox2')"> <span id="colorbox1" class="colorbox">____</span> <span id="colorbox2" class="colorbox">____</span><br />
    </form>
    Untested like before, but should work.

  6. #6
    Join Date
    Dec 2006
    Location
    Under a Bridge
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much ddadmin, your a life saver

  7. #7
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello!
    Can anybody knows how to set the color of the yui color picker ? i mean, send hex value and set the colorpicker gui to show it.
    thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •