Forums » Plugin: Conditional Fields for Contact Form 7 » Required fields inside conditional groups – CF7

  • Resolved mattheo

    (@mattheo)


    Hello,

    I’m actually using and enjoying “Conditional Fields” plugin on my wordpress website. I was wondering if it is possible to put a *required field inside a conditional group.

    e.g. in one of my event forms I ask users to specify the number of participants and then I ask them (with appearing conditional fields based on the number they picked) to insert the names.. unfortunately I am not able to set these name fields as * required. Can you help me?

    Thanks!

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

    (@jules-colle)

    Yes sure. Let’s take this example:

    [group g][text* t][/group]

    If the group g is visible during submission it will trigger a validation error for t if t is empty.

    Thread Starter mattheo

    (@mattheo)

    It doesn’t seem to work on my form. The submission works even if I leave text* fields empty, without any validation error.

    Here’s my code:

    <label> Numero partecipanti * 
         [select* posti include_blank "1" "2"] </label>
    
    [group group-partecipanti1]
    Nome e Cognome partecipante 1
    [text* partecipanti1 id:width100]
    [/group]
    
    [group group-partecipanti2]
    Nome e Cognome partecipante 1
    [text* partecipanti1 id:width100]
    
    Nome e Cognome partecipante 2
    [text* partecipanti2 id:width100]
    [/group]

    Do you notice any mistake?

    Plugin Author Jules Colle

    (@jules-colle)

    Yes, you are using duplicate field names. 2 fields are named partecipanti1

    Please read this: All field names should be unique

    USREC

    (@hawaiirealestate)

    Required fields inside conditional groups failing on my site also.
    Just started failing yesterday.

    <strong>1) Does any other party have an unrecorded interest in this Property and/or a say in its disposition? </strong>
    [radio Q1 "YES" "NO" "NTMK" "NA"]
    <br>
    [group Q1Y clear_on_hide disable_on_hide]
    <strong>Please Explain Yes Answer to Question 1</strong>
    [textarea* textarea-Q1Y]
    [/group]
    Plugin Author Jules Colle

    (@jules-colle)

    @hawaiirealestate please create a new topic

    Thread Starter mattheo

    (@mattheo)

    I solved. Now it works fine.
    The key was: All field names should be unique

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Required fields inside conditional groups – CF7’ is closed to new replies.