The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Multi-fields Is there such a thing?
I'm developing an online entry form for car shows using FF Pro and User Registration. The Registration form gathers the personal data for a new user, AND data defining three cars he/she may want to enter in a particular show. The car data will have several fields, e.g., Year, Make, Model.
I know that I could simply insert three sets of these fields,
Car_1Year, Car_1Make, Car_1Model
Car_2Year, Car_2Make, Car_2Model
Car_3Year, Car_3Make, Car_3Model
However, would be nice if I could somehow define a "Multi-field", and just insert three of them.
Is this possible?
Ed
March 7, 2018 at 9:01 am
It's possible, but you might want to explore the use of repeatable sections. Essentially you can add or subtract sets of fields, especially if the user is only going to insert 1 or 2 sets of fields, rather than the maximum of 3.
:Vaughn Bullard
March 7, 2018 at 3:13 pm
Thanks, Vaughn. Works perfectly.
But I don't understand why you say "especially if the user is only going to insert 1 or 2 sets of fields, rather than the maximum of 3" . Seems to me the user could add as many as wanted.
Also, I don't quite understand how this variable number of cars works with regard to the database table. E.g., if one user added 2 sections the table would be created with 2 sets of 3 fields. Then if the next user added 3 cars the table would need 3 sets of 3 fields, which would presumably necessitate creating a new table and copying the previous table date into it. Or, perhaps WP & FF is smart enough to set up "relational" tables, i.e., a table of cars, each row of which points to the owner's row in the table of users? Or, maybe somehow force creation of 3 sets of 3, with the unused ones defaulting to blank?
What am I missing?
Ed
March 7, 2018 at 3:23 pm
So there's a repeat limit for the section. When it comes to views, FF automatically builds a child table for that form. In the screenshots I attached, one shows the repeat limit. There's also a quick little snap of a Quote table selector with the line items attached to that quote form. You'll basically create a child view within a parent view, then passing it the parent id to filter the results.
Attachments:
March 8, 2018 at 4:50 pm
Vaughn,
I've set the limit and added a few site users with 2 or 3 cars each. It appears as if there is a single table for the site users in which there is a single field for each of the car attributes. In these fields are "tuples" representing the multiple cars. That is, if the user entered 2 cars the Color field will contain "Red, Black". See attached csv file.
Is there an easy way to create a report (view??) that would instead show a separate row for each car?
Or, perhaps you are giving me a hint (that I don't understand) when you say "You'll basically create a child view within a parent view, then passing it the parent id to filter the results."
Thanks for your help.
Ed
Attachment:
180308232104_register-site-user_formidable_entries.csv
March 8, 2018 at 6:38 pm
Well,
What you're looking at is creating two views. The first view would have the site users' top level information. You would then create a second view that repeats each of these tuples, say for example in a table row. All you'd need is a single row in the second view and put the appropriate field ids in the table cells. You'd then embed that second view shortcode in the first view.
Now, with that stated, you'd have to have a way to filter the results so you won't get every record in that child table. So you will have to filter the results by the parent id that you passed into the second view. This means you will get all records/fields that belong to the parent id.
Here's a very good example: https://formidableforms.com/help-desk/conditional-logic-for-repeatable-section-views/ If you follow the basic structure of what the moderator wrote, you should be golden.
:Vaughn
March 9, 2018 at 5:35 pm
I followed the example in the link. It works! See the attached screen shot.
The only problem is there's no indication of who the cars belong to. For example, in the screen shot the first two cars belong to one owner, but the next 3 belong to another owner. I'd like to insert the First & Last name either along with each set of car data, or as a header, so to speak, preceding all the cars belonging to that person. Presumably, I could do that in the child view, but I don't know how to refer to a field is another form. Could you give me a clue?
TIA
Ed
Attachment:
March 9, 2018 at 5:47 pm
Cool. You might want to try passing parameters in the view short code to the child view like so [display-frm-data id=285 firstname="[fieldID for the first name]" lastname="[fieldID for the last name]" filter=limited]. Simplest way I guess.
Discussion closed.