Preselect muliple choice radio with jquery

Home Forums Quform WordPress Preselect muliple choice radio with jquery

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17354
    jerkski
    Participant

    Is it possible to preset a multiple choice radio with Jquery? I am trying to set a gender radio selection based on what is stored in a function variable. My multiple choice options and values are the same to make troubleshooting easier. What I need is for the form to load data (which it already does for text fields) and set the radio selection based on the value.

    Here are my attempts. Neither of them select a radio option:

    function populate_suggested(idd)
    {
    jQuery(‘.iphorm_2_14’).val(jQuery(‘.’+idd).data(‘gender’)).prop(‘selected’, true);
    }

    function populate_suggested(idd)
    {
    var gender = jQuery(‘.’+idd).data(‘gender’);
    jQuery(‘.iphorm_2_14’).val($(‘.gender’)).prop(‘selected’, true);
    }

    Any thoughts? Again, I can set all other quform fields types with this method, just not multiple choice. Thank you!

    #17370
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17397
    jerkski
    Participant

    That fixed it! Thank you Ally! Awesome support as always!

    #17518
    jerkski
    Participant

    Hi Ally, related to this…when I try to submit the form data, even though the gender radio is chosen, the submit logic thinks that it is not. Is there something else that I am missing that would prevent it from submitting? Visually, it shows the proper radio is selected.

    #17526
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy