Jump to content

Hook into Select Option radio buttons


ttttim
 Share

Recommended Posts

I'm using a Select Option field for a user to select a color by name. In the back-end the radio buttons are showing the title of the color but the actual value (the Hex) can't be traced using the Inspector. Is there a way to hook into the Radio input field to add the Hex value if one is selected? I'd like to add the selected color to the background of the field after save.

Link to comment
Share on other sites

On 5/4/2020 at 5:02 PM, ttttim said:

Or is there a simple way to disable the JS colorpicker from https://modules.processwire.com/modules/fieldtype-color-picker/?

With FieldtypeColor https://modules.processwire.com/modules/fieldtype-color/ you have multiple options for the Inputfield:
Text, HTML5 Color, any Javascript ...

If you are able to create a custom SQL table for your colors FieldtypeSelectExtOption https://modules.processwire.com/modules/fieldtype-select-ext-option/ is a possible solution for your needs, since you can use the hex code as the value here.

 

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

@ttttim

I have added new Fieldtype Select Color Options to FieldtypeColor package. Read more here:

Furthermore, as @elabx  already mentioned, if you use Spectrum Color Picker as Inputfield in FieldtypeColor it is also possible to configure it to a select with predefined options:

https://bgrins.github.io/spectrum/#options-togglePaletteOnly

821848498_Bildschirmfoto2020-05-15um13_22_10.png.e267e284fe4602be1f9b5a2f5a416476.png

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...