Home › Forums › Quform WordPress › Prepopulate multiple choice (radio) when more than 2 choices
- This topic has 2 replies, 2 voices, and was last updated 7 years, 5 months ago by support.
- AuthorPosts
- October 24, 2016 at 8:38 pm #20183jerkskiParticipant
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?
October 24, 2016 at 11:52 pm #20186jerkskiParticipantI 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.
October 26, 2016 at 7:37 pm #20192supportModeratorHi
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 - AuthorPosts
- You must be logged in to reply to this topic.