We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    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.
      follow me on twitter: @dimmy01
      • 7455
      • 2,204 Posts
      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
        follow me on twitter: @dimmy01
        • 32963
        • 1,732 Posts
        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,
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 7455
          • 2,204 Posts
          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; 
          
            follow me on twitter: @dimmy01
            • 7455
            • 2,204 Posts
            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
              follow me on twitter: @dimmy01
              • 32963
              • 1,732 Posts
              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.
                xWisdom
                www.xwisdomhtml.com
                The fear of the Lord is the beginning of wisdom:
                MODx Co-Founder - Create and do more with less.
                • 7455
                • 2,204 Posts
                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)
                  follow me on twitter: @dimmy01
                  • 32963
                  • 1,732 Posts
                  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
                    xWisdom
                    www.xwisdomhtml.com
                    The fear of the Lord is the beginning of wisdom:
                    MODx Co-Founder - Create and do more with less.