Use answer from question 1 as answer alternative in question 2?

Hi!
For Question 1 in the form, a name is entered. I want to use that name as an answering alternative in question 2. Does anyone know how to do this?

Example:
Question 1, Enter your name:
Text field: John

Question 2, Choose who you want to apply for:
a. John
B. Someone else

Thank you!

Hi Eric !
Fun challenging question, I did a quick test on an idea and concluding it can be done with some coding, and assuming two other conditions:

  1. User is logged in to WP
  2. The Q2 field is in another page of the form, or different form from the Q1 form.
    –
    But I’m guessing there is some other trick the experts here know that will solve this for you, as time will tell…

If no one else responds with a better answer, and my two requirements are acceptable for your use case, I’ll do some more digging and update this thread with my “hack” solution.

Cheers and GL friend !

I understand.

Unfortunately, the user is not logged in. But yes, question 2 is at a different page then question 1 (for real question 2 is actually question x)

Sorry m8,

My solution leveraged the user table to cache the input field values recorded for the user’s “next page” event.

But I assume the same entry value is available to a filter function when handling pre-render of the second page of the form - then it would need to be inserted into the default value of the field element.

It would be nice if there was an easier way for your use case. Sorry I can’t be of much help.

There are a couple ways to do that. This is the easiest:

You could do it with JavaScript (unsupported, but that is possible.)

Finally, you could use the gform_pre_render filter to populate that name in the choices on the subsequent page of a multi-page form:

Thank you Chris. I think I’ll go with the Perk from GW :slight_smile:

1 Like