Convert checkbox field to radio button ?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
I have a field with input type as 'checkbox'. Is there way to change input type from checkbox to radio button?
Photo of ace

ace

  • 580 Points 500 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Mubeena

Mubeena

  • 278 Points 250 badge 2x thumb
can you elaborate your question please??
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
ace,

If this is a custom field, I'd recommend changing it to a picklist in Salesforce.  Then in your Skuid field editor, you can switch the rendering from picklist to radio button.  Make sure to set it to required if you do not want the 'none' option added.

If you don't want to change the field type, then you have 2 choices.

1. You can stay 'declarative' by adding a UI Only picklist to your model.  As above add the field to your field editor and set it to required and render as a radio button.  You'll then need to add a button to save your changes.  It should be a button that runs multiple actions.  Add a branch step and check for 'true' on your UI only field, then add 2 actions within the branch:  one to update the checkbox field to 'checked' and a save action on your model.  Following the branch step add an action to update the checkbox field to 'unchecked' and a save action on your model.


2. Go with a custom render using a JavaScript snippet.  This will simplify your 'save action' at the cost of writing a little JavaScript.

Thanks,

Bill