Ability to add products in the forms

I want to create a form for Purchase Order with the ability to add products right in the form. Basically, the user will input all of the information, and somewhere in the form, there is an added product section. It is simple, the user will select a product in dropdown select and then the user will click or press “add product” and the same dropdown will appear so the user will be able to select another product. Then if the user wants to add more products just click the same button again.

Think of it as a “list” with a dropdown select inside. Is this possible?

Thanks,
Waren

Hi Waren. You can use a Gravity Forms List field, and replace one of the columns with a drop down if you like. You can use these two filters:

to change to a drop down

to populate the dropdown if you need to

Let us know if you need something different.

1 Like

Thanks, @chrishajer! Already implemented this, I have two columns one is with the dropdown and I want the other one with some sort of validation like only accepting numbers only. How to achieve that?

Hi Waren. Changing that input to a number type is not currently supported. If you need front end validation (to prevent non-numbers from being entered) you will need to create the JavaScript to handle that validation up front. You could instead use the gform_field_validation filter to check the input once they submit the page, to ensure that what they submitted was a number, and return a validation error if it was not.

This is the filter I was recommending:

If you have any other questions, please let us know.

1 Like

Thanks, @chrishajer currently I was looking at this solution and working on applying this on the front-end. Thank you!

Another question, I successfully added few items in the dropdown selection. However, is there any way to create some sort of adding items to dropdown selection without hardcoding it in the functions.php file?

I’m thinking of creating a REST API using Google Sheet or creating a custom product post type and use the data in that dropdown selection.

Basically, making the dropdown selection dynamic so the client can add products without editing the code.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.