Home › Forums › Quform WordPress › Different fields on specific pages and one form
- This topic has 3 replies, 2 voices, and was last updated 1 year, 11 months ago by Ally.
- AuthorPosts
- December 8, 2022 at 9:46 am #35020RafalParticipant
Hello,
it is possible to check radio button by specific body class? Or different way, by specific page.
I would like to have one form on my website, but form should have different fields based on specific pages (i use conditional fields).
Example:
Page “Form test 1” – enable Country field, disable City field;
Page “Form test 2” – enable City field, disable Country fieldI created the appropriate structure and conditional logic of the form (screenshots in attachment).
Jquery code I created:
jQuery(function ($) {
if ($("body").hasClass("page-conditional-form-test-1")) {
document.querySelector('.quform-field-4_16_1').checked = true;
document.querySelector('.quform-field-4_16_1').checked = "checked";
}
else if ($("body").hasClass("page-conditional-form-test-2")) {
document.querySelector('.quform-field-4_16_2').checked = true;
document.querySelector('.quform-field-4_16_2').checked = "checked";
}
else {}
});
This works form me, but only on front-end (the fields change by page).
But there is a problem with writing to the database. Only the common field is saved (Name field), Country field and City field are not.Is there any way to do this?
Attachments:
You must be logged in to view attached files.December 8, 2022 at 10:22 am #35025RafalParticipantI noticed that the data is saved in the columns, but not in the main panel (single entry). I checked the box “show empty fields”.
Attachments:
You must be logged in to view attached files.December 8, 2022 at 2:03 pm #35029RafalParticipantProblem solved. Previously I had “Save to database” unchecked for radio buttons. Now the data saves correctly when I check this option.
- This reply was modified 1 year, 11 months ago by Rafal.
December 9, 2022 at 8:54 am #35032AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.