• Resolved pexel

    (@pexel)


    Hello;
    When we select color from the field options;

    While the user is selecting a color, can we also print the HEX RGB code of the selected color as text below?

    ——————————————————-

    Or if the user enters the HEX RGB code, does the color input change automatically?
    Thanks.

    • This topic was modified 1 year ago by pexel.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @pexel

    I’ll try to describe the process with a hypothetical example.

    Assuming the color field is the fieldname1, and the single line text field the fieldname2, insert an “HTML Content” field in the form and enter the following piece of code as its content:

    <script>
    fbuilderjQuery(document).on('change', '[id*="fieldname1_"]', function(){
    getField('fieldname2').setVal(this.value, true);
    });
    	
    fbuilderjQuery(document).on('change', '[id*="fieldname2_"]', function(){
    let v = String(this.value);
    getField('fieldname1').setVal(IF(v.charAt(0) != '#', '#', '') + v, true);
    });
    </script>

    Best regards.

    Thread Starter pexel

    (@pexel)

    Yes, when you select the color code, it gives the HEX code. Can we get the RGB code in the same way?

    And finally, if the user enters a hex value, will the color change directly?
    Thanks a lot.

    Plugin Author codepeople

    (@codepeople)

    Hello @pexel,

    The piece of code provided updates the fields in both directions. If you enter the color code directly into the “Single Line Text” field when the field triggers the onchange event, it updates the color field, and the same occurs in the other direction.

    Transform the color code between its different formats must be implemented by yourself as part of the form code. If you need a custom coding service, you can contact us via the plugin website: Contact Us

    Best regards.

    Thread Starter pexel

    (@pexel)

    I understand what you mean, it was successful. It was exactly what I was looking for. Now the HEX code is working. If we can get the RGB code with the same logic, my problem will be completely solved.
    Thanks a lot.

    Plugin Author codepeople

    (@codepeople)

    Hello @pexel

    If you need a custom coding service, you can contact us via the plugin website:?Contact Us

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Color Detail’ is closed to new replies.