How to use Radio Buttons with g_modal?

jglez1
Mega Guru

Hi all, is it possible to use radio button as a field type with the g_modal.showFields method? This is in a Workspace Client Script in a UI Action, by the way. (Utah)

 

I've been searching for documentation to see which fields are available, e.g. "textarea", "choice", etc. but I haven't been able to find any.

 

jglez1_1-1689611949497.png

 

jglez1_0-1689611890174.png

Thanks,
Jorge

1 ACCEPTED SOLUTION

Hi @saisurendra, what's your use case? We were not able to get radio buttons using g_modal.showFields()

 

Our team ended up forgoing g_modal.showFields() and instead went with a UI Page to build a completely custom modal and used g_modal.showFrame() to render it in our Workspace.

 

View solution in original post

5 REPLIES 5

Syed30
Tera Expert

Hi @jglez1 

Yes, it is possible to use a radio button as a field type with the g_modal.showFields.

To use a radio button as a field type, you can define a field configuration object with the necessary properties. Here's an example:

 

var fieldConfiguration = {
  name: 'radio_field',
  label: 'Radio Field',
  type: 'radio',
  choices: [
    {
      value: 'option1',
      label: 'Option 1'
    },
    {
      value: 'option2',
      label: 'Option 2'
    },
    {
      value: 'option3',
      label: 'Option 3'
    }
  ]
};

g_modal.showFields({
  fields: [fieldConfiguration],
  onSubmit: function (values) {
    // Handle the submitted values
    var selectedValue = values.radio_field;
    // Do something with the selected value
  }
});

 

Hi @Syed30, thanks for your reply!

 

I've tried the code snippet you've provided, but the radio buttons aren't appearing on the modal for me.

 

jglez1_0-1689618000064.png

jglez1_2-1689618034014.png

 

jglez1_1-1689618014528.png

 

Hi @jglez1 , Any luck on 'radio button' in g_modal fields, only choice is the option im able to find so far.

Please let me know if you got any other solution.

 

Thanks,

Surendra

Hi @saisurendra, what's your use case? We were not able to get radio buttons using g_modal.showFields()

 

Our team ended up forgoing g_modal.showFields() and instead went with a UI Page to build a completely custom modal and used g_modal.showFrame() to render it in our Workspace.