Announcement

Collapse
No announcement yet.

Radio Button Selected by Default

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mstella1
    replied
    Originally posted by Bruce - PhosphorMedia View Post
    You could probably do this now by using javascript/jquery on the page before the form container.

    e.g. https://stackoverflow.com/questions/...ad-with-jquery
    Thanks Bruce!

    I forgot to post what I ended up using in case someone else needs it.

    HTML Code:
    <script>
    document.addEventListener("DOMContentLoaded", function () {
    function checkRadioButtonByValue(value) {
    const radioButtons = document.getElementsByName("mmx_contactform:fields[1]");
    for (const radio of radioButtons) {
    if (radio.value === value) {
    radio.checked = true;
    break;
    }
    }
    }
    
    // Automatically select the desired radio button when the page loads
    checkRadioButtonByValue("Text label here for the option to be selected");
    });
    </script>

    Leave a comment:


  • mstella1
    replied
    Originally posted by Nick View Post
    mstella1 The Contact Form flex component does not have that feature for radio buttons. I will add this as a feature request and hopefully we can get it added in a future update.
    Thanks Nick, I guess the other one to add as a feature request is for checkboxes as well. I was going to use that instead for now and having a checkbox "checked" isn't an option.

    Leave a comment:


  • mstella1
    replied
    Originally posted by Bruce - PhosphorMedia View Post
    You could probably do this now by using javascript/jquery on the page before the form container.

    e.g. https://stackoverflow.com/questions/...ad-with-jquery
    Thanks I will give that one a shot later today!

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    You could probably do this now by using javascript/jquery on the page before the form container.

    e.g. https://stackoverflow.com/questions/...ad-with-jquery

    Leave a comment:


  • Nick
    replied
    mstella1 The Contact Form flex component does not have that feature for radio buttons. I will add this as a feature request and hopefully we can get it added in a future update.

    Leave a comment:


  • mstella1
    started a topic Radio Button Selected by Default

    Radio Button Selected by Default

    Hi,

    In PageBuilder is there a way to have a radio button selected by default in a form? The form I have to make needs one to be selected and I am not seeing that anywhere.

    Thanks,
    Mike
Working...
X