• And another wish (sorry)#

  • Dimmy Reply #1, 7 years ago

    Reply
    could we set the htmlArea color picker as a TV?

    this way its clear what you choose instead of a label in list menu like "rusty brown reddish" or "bleu-purple" or "could be green" (;

    I like to make my own TV's but I do not realy know how yet.


  • Dimmy Reply #2, 7 years ago

    Reply
    This picker would also work I think

    http://www.softcomplex.com/products/tigra_color_picker/docs/#top

    but not sure how to make a tv of it, I managed to make it work as stand alone html but not as a TV what files do I need to edit to add this color picker?

    I think in the first place:

    tmplvars.inc.php and make a new case?

    like this maybe:

    			case "color": // handles colors
    				$field_html .='<input type="color" name="tv'.$field_name.'"  '.$field_style.' onclick="documentDirty=true;setVariableModified(\''.$field_name.'\');" /><br>';
                    $field_html .='<script type="text/javascript" src="media/colorpic/picker.js"></script>';
    				$field_html .='</script>';
    				$field_html .='<a href="javascript:TCP.popup(document.forms['formname'].elements['"tv'.$field_name.'"'])"><img width="15" height="13" border="0" alt="Click Here to Pick up the color" src="img/sel.gif"></a>
    				break;
    


    but this does not work i am missing some parts I think hehe
    just started playing with php a bit (just got my php for dummy's book hehe)

    I am missing a form name variable in this file so i filed it with formname.

    Hope that somone can help me along with this one.
    it would be nicer to implement the htmlArea picker but could not figre that one out at all.

    Greets Dimmy


  • xwisdom Reply #3, 7 years ago

    Reply
    Hi Dimmy,

    In addition to your above changes you need to add this option to mutate_tmplvars.dynamic.action.php just below line 309 (inside the <select> tag):

    Edited:

    <option value="color" <?php		echo ($content['type']=='color')? "selected='selected'":""; ?>>Color Picker</option>
    


    This should do the trick.

    Best regards,


  • Dimmy Reply #4, 7 years ago

    Reply
    IT WORKS!!!
    the color picker is working the input field is filled with a hex#

    it looks like this now:
    case "color": // handles colors 
                $field_html .='<input type="text" name="tv'.$field_name.'"  value="'.$field_value .'" '.$field_style.' onclick="documentDirty=true;setVariableModified(\''.$field_name.'\');" /><br>'; 
                $field_html .='<script type="text/javascript" src="media/colorpic/picker.js"></script>'; 
                $field_html .='</script>'; 
                $field_html .='<a href="javascript:TCP.popup(document.forms[\'mutate\'].elements[\'tv'.$field_name.'\'])"><img width="15" height="13" border="0" alt="Click Here to Pick up the color" src="media/colorpic/sel.gif"></a> ';
                break; 
    


  • Dimmy Reply #5, 7 years ago

    Reply
    mm but somehow it does not save this setting on the computers I have tryed it on
    but on another machiene my friend has it does work.

    ok when there is no default string set i can enter somting by hand and it will save but when i use the colorpicker it will not save the string

    and also when there is a default string set it wil not save and keep the default string.

    it looks like i need to manualy be active in this field to make it work somehow

    it only works when i'v bin active in the field manualy that all the cases above work


    could somthing be missing?

    all other tv's work with no problem


  • xwisdom Reply #6, 7 years ago

    Reply
    mm but somehow it does not save this setting on the computers I have tryed it on
    but on another machiene my friend has it does work.

    ok when there is no default string set i can enter somting by hand and it will save but when i use the colorpicker it will not save the string

    and also when there is a default string set it wil not save and keep the default string.

    it looks like i need to manualy be active in this field to make it work somehow

    it only works when i'v bin active in the field manualy that all the cases above work


    could somthing be missing?

    all other tv's work with no problem

    You need to call invoke the onchange event of the textbox.

    For example:

    textbox.onchange(), where textbox if the form element used in your color picker

    This will flag that TV as a modified variable.


  • Dimmy Reply #7, 7 years ago

    Reply
    You need to call invoke the onchange event of the textbox.

    For example:

    textbox.onchange(), where textbox if the form element used in your color picker

    This will flag that TV as a modified variable.

    now you lost me,
    i tryed chanching the onClick statment in to onchange but that did not do the trick.


    could you tel me where to put this statement in the code?

    case "color": // handles colors 
                $field_html .='<input type="text" name="tv'.$field_name.'"  value="'.$field_value .'" '.$field_style.' onclick="documentDirty=true;setVariableModified(\''.$field_name.'\');" /><br>'; 
                $field_html .='<script type="text/javascript" src="media/colorpic/picker.js"></script>'; 
                $field_html .='</script>'; 
                $field_html .='<a href="javascript:TCP.popup(document.forms[\'mutate\'].elements[\'tv'.$field_name.'\'])"><img width="15" height="13" border="0" alt="Click Here to Pick up the color" src="media/colorpic/sel.gif"></a> '; 
                break; 
    


    or what to change / add I am lost (Yes I am a reel newbe on this sorry)


  • xwisdom Reply #8, 7 years ago

    Reply
    Hi Dimmy,

    From what it seems you might have to modify the TCP.popup javascript file to trigger the onchange event after setting the value on the form element.

    __
    Raymond Irving