Jump to content

Radio buttons as custom fields for images


Recommended Posts

Posted

How can I use a radio button with multiple options (as shown below in the image under “license”) in an image field?
Is this also possible with a select field? Which fields can I use?

 

screen_shot_2019-10-11_at_11_52_52_am.10

Posted

Hi
when it comes to a "select" just install the select options module which is in pw by default and then when adding a new field you'll be able to choose

image.png.0cc308b4a82bc99055cc7f2dd8c7ca69.png

when it comes to images, having a close look at the full article from which the image you show comes
https://processwire.com/blog/posts/pw-3.0.142/
you'll see that it relies on a template you create witjh a given naming convention 
--- quote---
Rather than trying to come up with some new way of defining custom fields, you define the custom fields for your file/image field with a Template. Simply create a template having the name "field-[name]" (replacing "[name]" with the name of your file/image field), add fields to it, save, and that's it. It's okay to add fields that might duplicate those already on your regular page template, as the fields for files/images are properties of each file/image rather than properties of any page.
-------
not only will you be able to use radio button but nearly any kind of fields you would like to associate to the image

hope it helps a little 🙂

have a nice day

  • Like 2
Posted

@virtualgadjo

Thank you very much for your reply. The “select” fields you mentioned do not appear in my image field when I add them as custom fields. Apparently, not all fields can be used.

Quote

You may use fields of these types: Text, Textarea (non CKEditor), Integer, Float, Page Reference, Checkbox, Toggle, Datetime, Email, URL. You may also use the multi-language versions of core Fieldtypes

 

Posted

Hi again 🙂
actually, all those fields are not available in an image field by default but become so when you associate a specific template to the given image field
say for example you have an image field named myfooimg if you create a template named field-myfooimg all the fields you use in this template will be availabe for you image datas, text, list of radio/checkboxes and so on...

have a nice day

Posted

I just tried on a test setup to install the FieldtypeOptions module and add it as an image’s custom field but it is not displayed when editing an image, nor is it available to toggle on in the FieldtypeFile’s module settings:

Screenshot2025-11-06at15_30_41.thumb.png.19f2e465b78777aac2e7afed26e885db.png

Screenshot2025-11-06at15_31_05.thumb.png.c0ff86153250cf4a061a4c209f509949.png

Screenshot2025-11-06at15_31_55.thumb.png.5e948dfba1fc9a07125cd635a6c8c4b5.png

Screenshot2025-11-06at15_30_29.thumb.png.665d7c8800f396fffaeea43cb4251545.png

And it's actually normal behavior as this Fieldtype is basically blacklisted as a FieldtypeFile’s custom field.

@tires your best bet is to use a Page field instead and have your options stored as pages somewhere:

Screenshot2025-11-06at15_41_13.png.9fa6fce1556fdeb87684a62938a8711d.png

Screenshot2025-11-06at15_42_19.thumb.png.fe48e594efde07df031a8fbea1699737.png

  • Like 1
Posted

hi again 🙂

@monollonom is right the solution is to use pages, you can do this with the page reference fielfd and get this kind of thing quite easily
image.png.36af521f03eaeffee89c15d8386f48e0.png

sorry most things are in french its just in a demo website i use to help french guys with pw 🙂
you can see i hav a spécial field named resume and a list of radio button coming from a page reference field allowing hidden pages, the parent page is like this
image.png.849aa34462caedef2cb0f26d63906750.pngimage.png.9907a567d8ecf0deb44592631b4d6c24.png

as you can read in the blog page, you can use any kind of type for those page reference fields, actually it works a lot like the way i use them for blog categories and/ot tags
image.png.f4a43a281efc4ab03e2ee3d7e33f7680.png

have a nice day

  • Like 1

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
  • Recently Browsing   0 members

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