Web Development Estimate Generator

By: Matt Stanley | Asked: 01/01/2023
ForumsCategory: Code HelpWeb Development Estimate Generator
Matt Stanley asked 2 years ago
Hey guys, I want to use formidable to create a dynamically-powered, web development project estimate price generator. I already have a data form that stores every "product" I may need to purchase from a subcontractor/vendor/freelancer. I am using a combination of lookup fields, conditional logic, and calculation functionality to determine what each component will cost. What I need help with, however, since it does NOT do it "out of the box" is splitting out a list of values returned from a set of cascading lookup fields and adding them together.  You can see the preliminary stages of what I'm trying to build at the following address: https://estimates.theweboasis.com/wp-admin/admin-ajax.php?action=frm_forms_preview&form=contact-form * * Log into the popup window with username flywheel and password resonant-plum I will eventually add fields to handle markup multiplication, project management fees, credit card processing fees, etc. For now, however, without a JavaScript snippet that splits out the list of returned values as separate items and adding them together I'll have to do the initial calculation myself by adding everything up and typing that total into a field. I WANT to have the form figure out that total itself.  I'm not a programmer so I would really appreciate some help... If somebody can give me code with comments that explains what to customize I am experienced enough that I should be able to "make the code my own," but I need a good starting place.
Michael ClarkMichael Clark replied 2 years ago

Hi Matt, I may be over simplifying, so forgive me if you've thought of this already:

Would the functionality of Formidable's [frm-math ..] feature work for you? Maybe nested Views with combined with get-set to grab the desired values, use the values in formulas and calcs built with frm-math, and use results to dynamically build params that would populate form fields?

Matt Stanley replied 2 years ago

Michael,

Thank you for your comment! I don't know if that would work or not because I've never used that feature... I specifically described in very explicit detail what I was trying to do in a support request I submitted through Formidable's help desk and they said what I was trying to accomplish could not be done with their plugin. They said I'd have to use JavaScript to accomplish my objective.

If your approach would actually work I'm all for trying it since I can't write custom JavaScript to save my life! I'll run your suggestion past support and see what they have to say. I'm by NO means a Formidable newbie, but when it comes to really advanced custom stuff like I'm trying to build with my dynamic WebDev Estimate Generator I'm feeling out my depth and I don't really have budget to pay someone to help with it. 🙂

1 Answers
Victor Font answered 2 years ago
I've looked at your form. What fields are you referring to when you say "splitting out a list of values returned from a set of cascading lookup fields"? There are no cascading lookup fields on your examplar. Unless you've have the dropdowns set to multiselect, each dropdown will return a single value. There won't be a list of multiple values. You can just use Formidable's build in calculations the way your form is design right now.
Matt Stanley replied 2 years ago

Hey Victor, thank you so much for responding to my query!

My original version of this form had a bunch of fields hidden with conditional logic if the value of the field named "Dynamically Generated Cost" was NOT greater than zero. I just updated the form to get rid of that because after thinking about it, that design choice made no sense. To answer your specific question, the form uses cascading lookup fields as follows:

1. The matching values are presented in the field named "Vendor(s) Used" based on which value(s) are chosen in the field named "Service(s) Required."
2. The matching values are then presented in the field named "Web Development Services Required" based on which value(s) are chosen in the field named "Vendor(s) Used."
3. The matching values are then presented in a comma-separated list in the field named "Dynamically Generated Cost" based on which value(s) are chosen in the field named "Web Development Services Required."

What I need is to add JavaScript that converts the comma-separate list of values into individual values then adds them up and writes that sum as a numeric value into the field named "Dynamically Generated Cost." I asked Formidable support about how to do this and they said their plugin is unable to do an automatic sum calculation, but it's totally doable with JavaScript.

I can't write JavaScript from scratch like this, but if I had a well-commented script I'm confident I could modify and customize it to work for my needs.

So what I need specific help with is getting the JavaScript itself AND how to implement/use it in Formidable.

I figured out how to use the JavaScript math operator Math.ceil to round up to the nearest dollar amount when adding the value of two fields together. I have no idea how to implement what I'm trying to do with this calculation, however.

Can you help me with this?

Victor Font replied 2 years ago

Where do the numbers come from in the Web Development Services Required field?

Matt Stanley replied 2 years ago

Great Question! That data is populated using a Lookup Field that is configured as follows:

Get Options From = DATA FORM: Vendors+Products
Selector Field = Product
Filter by Lookup Fields = Vendor(s) Used

I also have that field set up with Conditional Logic as follows:
Show this field if Service(s) Required equals WebDev

Victor Font replied 2 years ago

I can't guarantee this snippet will work because I can't test it on your site, but it should give you a starting point. <a href="https://gist.github.com/vfontjr/83210a57ccafed9f31bffc32aa1347e3&quot; rel="nofollow">https://gist.github.com/vfontjr/83210a57ccafed9f31bffc32aa1347e3</a&gt;

Copy the snippet to the Before Fields area on the form's Customize HTML page. Change the field_xxx to the HTML id of the field containing the comma separated string. Use our browser's inspection tool to get the ID.

Bobby Clapp replied 2 years ago

Full disclosure: I've not looked at the form in detail. My comment is basis of the theory presented in the opening post.

Can you put the lookups in a repeater and then have the value determined per repeater and then use this:

https://formidableforms.com/knowledgebase/repeatable-section/#kb-get-the-total-of-the-values-of-a-repeater-field

Matt Stanley replied 2 years ago

Hey Victor,

If I gave you a temporary Administrator login to the site would you be willing to help me with this further? I copied and pasted the exact code and put it in the location you said and changed the ID to be the correct one but it's not working. I would really like to get this working. I'd even be willing to pay you a bit if you can get it fixed and the investment would not be cost-prohibitive.

Please advise; thanks!

Victor Font replied 2 years ago

No, I won't access anyone's site that's not currently a client. My business focus is enterprise software engineering. If you want to contract with me, please apply at https://formidable-masterminds.com/project-application/.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right