Prepopulate multiple choice (radio) when more than 2 choices

Home Forums Quform WordPress Prepopulate multiple choice (radio) when more than 2 choices

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

    Hello, I have an issue that was previously resolved, but related. I am trying to populate multiple choice (radio) elements from stored variables. I have no problem with an element that has 2 options (MALE/FEMALE). If I look in the database it simply says MALE or FEMALE. This works fine. However, I now have a multiple choice element with 4 options. When I try to access them from the variable, they do not populate using similar code. When I look in the database they are saved with a comma at the end of the string (value). This is odd because the nature of radios, only allow one selection. Why would there be a comma? Here is my function to access and populate the field with the variable:

    function populate_suggested(idd)
    {

    jQuery(‘.iphorm_2_175’).each(function() {

    if (jQuery(this).val() == jQuery(‘.’+idd).data(‘insrelationship’)) {

    jQuery(this).click();
    }
    });
    jQuery.uniform.update();

    }

    Any thoughts on why this would work with 2 options and not 4, and does the comma affect this since the values for each option do not have a comma?

    #20186
    jerkski
    Participant

    I figured it out… I have a comma accidentally added in the database settings for the form. Once I did that, the radio selection was automatic. Solved.

    #20192
    support
    Moderator

    Hi

    Sorry for the delay. Glad to know the issue is resolved ! Don’t hesitate if you have any other issue or question.

    Regards,
    Félix

Viewing 3 posts - 1 through 3 (of 3 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