adding a class to radio input in editor

adding a class to radio input in editor

belubelu Posts: 38Questions: 14Answers: 0

Hi there,

I used the "class": "classname" attribute successfully on a <select> input successfully, but it does not work with radio buttons.
Did I do something wrong or does this possibility just not exist?

here is the part of my code:

table: '#wish_days_off',
fields: [
{
// Dropdown
label: "<?= Settings::getUsernameWording(); ?>:",
name: "days.user_id",
type: "select",
attr: {
"class": "browser-default custom-select"
},
placeholder: "bitte wählen..."
},
{
label: "Priorität:",
name: "days.priority",
type: "radio",
attr: {
"class": "form-check-input"
},
def: "1",
multiEditable: false,
options: [
{
label: "<?= Settings::getWishfreeWordingPriorityLow(); ?>",
value: <?= Wish_days_off::PRIORITY_LEVEL_LOW; ?>
},
{
label: "<?= Settings::getWishfreeWordingPriorityMiddle(); ?>",
value : <?= Wish_days_off::PRIORITY_LEVEL_MIDDLE; ?>
},
{
label: "<?= Settings::getWishfreeWordingPriorityHigh(); ?>",
value: "<?= Wish_days_off::PRIORITY_LEVEL_HIGH;?>"
}
],
},

Thanks in advance!
Best regards,
Bernhard

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Hi Bernhard,

    The issue here is that the radio inputs are one per option, while the select list list is one input for all options.

    So what I think you'd need to do here is use the API:

    editor.field('days.priority').input().addClass('myClassName');
    

    Allan

  • belubelu Posts: 38Questions: 14Answers: 0
    edited January 2019

    Hi Allan,

    you are genius! This works perfect! Have been trying and searching the whole afternoon for a solution...
    1000 Thanks!

    Best regards from Austria,

    Bernhard

This discussion has been closed.