Support » Plugin: Conditional Fields for Contact Form 7 » CF7 pass all parameters of conditional fields

  • Resolved stefanoforcina

    (@stefanoforcina)


    Hi, I have a form with conditional fields.
    For example:
    price_adult changes according to the chosen excursion.
    If the excursion is Rome the price_adult field is 60 euros, if Naples is 55 euros and if Capri is 30 euros.
    When I select the excursion Rome, in the price_adult field I see the correct value (60 euros) but after pressing send, CF7 passes me via URL ALL PARAMETERS (60 euros, 55 euros and 30 euros) and not only 60 euros!
    Help me, thank’s…

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    fields are merely hidden by the conditions, not removed. so it’s normal all fields are passed. You can figure out which fields were shown via $_POST['_wpcf7cf_hidden_group_fields']

    • This reply was modified 2 months, 2 weeks ago by  Jules Colle.

    Hi Jules, happy new year and thank’s…
    I’ll explain.

    <label> Escursione 
        [select* escursione include_blank "Capri" "Pompei-Vesuvio" "Sorrento-Amalfi" "Roma" "Napoli-Caserta" "Ischia"] </label>
    
    [group group-578]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "85,00"] </label>
    [/group]
    
    [group group-579]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "50,00"] </label>
    [/group]
    
    [group group-580]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "60,00"] </label>
    [/group]
    
    [group group-581]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "55,00"] </label>
    [/group]
    
    [group group-582]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "35,00"] </label>
    [/group]
    
    [group group-583]
    <label> Tariffa adulto Euro
        [text tariffa_adulto readonly "60,00"] </label>
    [/group]
    
    [group group-584]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "55,00"] </label>
    [/group]
    
    [group group-585]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "30,00"] </label>
    [/group]
    
    [group group-586]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "40,00"] </label>
    [/group]
    
    [group group-587]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "35,00"] </label>
    [/group]
    
    [group group-588]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "20,00"] </label>
    [/group]
    
    [group group-589]
    <label> Tariffa bambino Euro
        [text tariffa_bambino readonly "40,00"] </label>
    [/group]

    When I choose a city from the excursion field, for example Rome, in the form I only see group-581 and group-587.
    This is ok.
    But when I send the form, it also pass all the other hidden groups and I do not need them because I need only two values (one for tariffa_adulto and one for tariffa_bambino) to calculate the total.
    This is possible?

    Thank’s for your support…

    In the Redirect Settings tab I have selected:
    Pass specific fields from the form as URL query parameters
    supplemento_lingua_value, tariffa_adulto, tariffa_bambino, tariffa_infant, numero_adulti, numero_bambini, numero_infant
    and it pass me this:

    http://baiadomiziaincoming.it/prenota-escursione/?lingua=Francese&supplemento_lingua_value=15,00&supplemento_lingua_value=0,00&tariffa_adulto=85,00&tariffa_adulto=50,00&tariffa_adulto=60,00&tariffa_adulto=55,00&tariffa_adulto=35,00&tariffa_adulto=60,00&tariffa_bambino=55,00&tariffa_bambino=30,00&tariffa_bambino=40,00&tariffa_bambino=35,00&tariffa_bambino=20,00&tariffa_bambino=40,00&tariffa_infant=0,00&numero_adulti=5&numero_bambini=4&numero_infant=3

    Plugin Author Jules Colle

    (@jules-colle)

    all fields names need to be unique, so what you are trying to do won’t work this way.

    Can’t you just simply pass the escursione parameter, and then figure out the price with some PHP and the querystring?

    Yes you are right.
    I could just pass the excursion parameters, number of adults and number of children, and then in PHP with a series of if or switch cycles I could get the right prices.

    Thank you for the support you gave me.

    Plugin Author Jules Colle

    (@jules-colle)

    no problem. Feel free to leave a review 😉

    You’re a special person, I left you a review…

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.