0

In Gravity Forms, I have a form containing some input fields asking for number of rooms for each room type.

How can I dynamically add input fields for number of each content in the room? Eg if the previous input field was entered as Bedrooms: 2

Then how can I dynamically add a section or table asking for quantity of contents for each room such as:

Bedroom 1
Bed (Kind): n
Bed (Queen): n
Content N: n...

Bedroom 2
Bed (Kind): n
Bed (Queen): n
Content N: n...

Is there a advanced field to do this? I guess I may need to use JS to do this? If so, how can I make sure these fields can be seen in entries?

I'm thinking of using table, but not sure how to with Gravity Forms.

4
  • 2
    Not sure about this, but have you considered using conditional logic? If I recall correctly, it is an inbuilt feature but effectively it would work something like "only show bedroom 1 section if no_of_room is equal to or is more than 1" and then "only show bedroom 2 section if no_of_room equals to or is more than 2" Was initially thinking about the Dynamic population feature but not sure it would really apply in this case.
    – Flick
    Mar 15, 2014 at 21:06
  • Yeah that is what I thought of too. But if I have a max of 10 room numbers allowed then I would need to setup 10 or so conditional logic and input fields, right?!
    – Qwerty
    Mar 15, 2014 at 21:54
  • How would one show sections? Like you mentioned Bedroom N section which wraps input fields for the number of contents in a room...is it possible to group these into section in Gravity Form? If so how?
    – Qwerty
    Mar 15, 2014 at 21:55
  • 1
    gravityhelp.com/documentation/page/Section_Break I can't say if having multiple sections is the best way forward though. One other option might be to create these repeating list fields: gravityhelp.com/documentation/page/List (and change them to other types using e.g. gravityhelp.com/documentation/page/Gform_column_input)
    – Flick
    Mar 16, 2014 at 20:07

1 Answer 1

2

Your best bet out of the box is using the List field. You can enable multiple columns for each bedroom feature (i.e. "Bed (King)", "Bed (Queen)", "Content", etc) and then each bedroom would be represented by a row on the list field. The user can add/remove bedrooms via a plus/minus UI at the end of each row.

Alternately, if you will have a large number of fields per row, I have a perk in the works called "GP Nested Forms". It's a little easier to show how it works than explain (see the video below) but the primary purpose is a clean way to include decent sized forms within other forms, especially when you need to add multiple instances of the child form.

http://www.screencast.com/t/p7sAHutMVfG

If this interests you, you can pick up a copy of Gravity Perks here and I can send you a copy of the Nested Forms perk (not yet publicly available).

Edit

This has been further polished here:

https://gravitywiz.com/documentation/gravity-forms-nested-forms/

4
  • Ah ok, the idea in the 1st paragraph is good. But I may have 10 or more contents/features listed for each type of room. Is it possible to layout the table such as this: tinypic.com/r/2zfmlj7/8
    – Qwerty
    Mar 18, 2014 at 1:29
  • So laying out the columns in 1 row wouldn't be ideal...I like this implementation though: gravitywiz.com/require-all-columns-of-list-field Not sure how I would do this with many features/contents fields for each room
    – Qwerty
    Mar 18, 2014 at 1:31
  • For the child form, would you be able to provide the perk you are mentioning voluntarily? Or do I have to purchase the entire copy of package? I just require this one functionality..
    – Qwerty
    Mar 18, 2014 at 1:50
  • I will use list field instead as you suggested. I would like to know following to customize list field: How can I change the input type of the fields in the list to number instead of text type? Add text at the start of each row so that I get Room 1, Room 2, etc for each row....once row(s) are added? Space the columns out evenly rather than dependent on the text for each column heading?
    – Qwerty
    Mar 18, 2014 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.