Different fields on specific pages and one form

Home Forums Quform WordPress Different fields on specific pages and one form

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35020
    Rafal
    Participant

    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 field

    I 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.
    #35025
    Rafal
    Participant

    I 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.
    #35029
    Rafal
    Participant

    Problem 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.
    #35032
    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 4 posts - 1 through 4 (of 4 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