questionnaire 1

Show fields one by one and hide completed fields

This example shows how you can use Conditional Fields for Contact Form 7 to create a form that will force the user to fill in fields in a particular order by only displaying the next field if the previous field is filled out. In this example the fields disappear after they are filled, and then display a new field. In some cases you might want all fields to remain visible and editable after they are filled out. This can also be achieved with CF7CF. An example of this is questionnaire 2.

Form

    Question 1: Hi, how are you?

    Question 2: What is your favorite color?

    Question 3: What is your least favorite color?

    Question 4: Do you like my website?

    Question 5: Do you like this plugin?

    Question 6: Do you like random questions?

    Question 7: How the hell are you supposed to answer this question?

    Question 8: Wow! You made it pretty far already, seems like you really enjoy filling out this questionnaire, don't you?

    Question 9: One more question after this one. Okay?

    Question 10: Just answer yes or no and the submit button will appear!

     

    Form Code

    [group g1]
    Question 1: Hi, how are you?
    [select q1 "---" "I'm great" "I'm fine" "Not so well"]
    [/group]
    
    [group g2][group g2sub]
    Question 2: What is your favorite color?
    [select q2 "---" "red" "blue" "yellow" "something else"]
    [/group][/group]
    
    [group g3][group g3sub]
    Question 3: What is your least favorite color?
    [select q3 "---" "red" "blue" "yellow" "something else"]
    [/group][/group]
    
    [group g4][group g4sub]
    Question 4: Do you like my website?
    [select q4 "---" "yes" "no"]
    [/group][/group]
    
    [group g5][group g5sub]
    Question 5: Do you like this plugin?
    [select q5 "---" "yes" "no"]
    [/group][/group]
    
    [group g6][group g6sub]
    Question 6: Do you like random questions?
    [select q6 "---" "yes" "no"]
    [/group][/group]
    
    [group g7][group g7sub]
    Question 7: How the hell are you supposed to answer this question?
    [select q7 "---" "yes" "no"]
    [/group][/group]
    
    [group g8][group g8sub]
    Question 8: Wow! You made it pretty far already, seems like you really enjoy filling out this questionnaire, don't you?
    [select q8 "---" "yes" "no"]
    [/group][/group]
    
    [group g9][group g9sub]
    Question 9: One more question after this one. Okay?
    [select q9 "---" "yes" "no"]
    [/group][/group]
    
    [group g10][group g10sub]
    Question 10: Just answer yes or no and the submit button will appear!
    [select q10 "---" "yes" "no"]
    [/group][/group]
    
    [group gsubmit]
    [submit]
    [/group]
    <p>&nbsp;</p>

    Email Body

    q1: [q1]
    q2: [q2]
    q3: [q3]
    q4: [q4]
    q5: [q5]
    q6: [q6]
    q7: [q7]
    q8: [q8]
    q9: [q9]
    q10: [q10]

    Conditional Fields (Text)

    show [g1] if [q1] equals "---"
    show [g2] if [q2] equals "---"
    show [g2sub] if [q1] not equals "---"
    show [g3] if [q3] equals "---"
    show [g3sub] if [q2] not equals "---"
    show [g4] if [q4] equals "---"
    show [g4sub] if [q3] not equals "---"
    show [g5] if [q5] equals "---"
    show [g5sub] if [q4] not equals "---"
    show [g6] if [q6] equals "---"
    show [g6sub] if [q5] not equals "---"
    show [g7] if [q7] equals "---"
    show [g7sub] if [q6] not equals "---"
    show [g8] if [q8] equals "---"
    show [g8sub] if [q7] not equals "---"
    show [g9] if [q9] equals "---"
    show [g9sub] if [q8] not equals "---"
    show [g10] if [q10] equals "---"
    show [g10sub] if [q9] not equals "---"
    show [gsubmit] if [q10] not equals "---"