Any possibility to do the calculation field?

Any possibility to do the calculation field?

I have a situation that is:

The Lead/Customer arrives on a page where there is a form.

This form contains a select field that pulls information from a CPT. The CPT has 5 options to choose from, each of which has a reference value for calculation.

These reference values can have numbers in the style of 0.0000 (must have this possibility)

When selecting one of the options through the select field, it fills in another 6 hidden fields, where these fields are used in the calculation field.

After the Lead, he inserts his name, e-mail and telephone (this I know bricksforge can do);

After the Lead, it informs a monthly Consumption value (Field Range Filter). This value will also be used in the calculation field along with the other information in the select field.

Lead clicks the submit button.

This calculation field, after calculating according to the informed formula, will insert the result in another CPT for lead capture.

After that, he is redirected to the thank you page where he presents the calculation value to Lead.

Can I do this with BricksForge?

See the formula in the image.


Daniele: How much would you charge me to implement this function in bricksforge? And obviously make it available to everyone afterwards?

Hi. Could you simplify your example regarding the “calculation”-field?

Sometimes it is better to show something with a very simple example so that we can better understand the basic requirement.

My understanding: A field with which you can perform individual calculations.

Example: ({field-id-12345} + {field-id-6789} / 2) + (2*7)

The output would then be the calculated sum.

Is this what you mean?

Yes. That’s right. Pionet has this field, WS Forms has this field. I’ll send an example of their sites and also the formula I need for you to have as an example.

example de wsforms Calculated Fields – WS Form

my formula: (([field id=“valorcliente”]-([field id=“custoum”]([field id=“tarifa”]/(1-(0.010[field id=“pis_cofins”]))/(1-(0.010*[field id=“icms”])))+[field id=“ilunapub”]))/([field id=“tarifa”]/(1-(0.010*[field id=“pis_cofins”]))/(1-(0.010*[field id=“icms”]))))[field id=“tarifa”](0.010*[field id=“desconto”])

can you do it? please? for the next version? :smiley:

Thanks very much for the clarification. The calculation field is a good idea. I will add it to the roadmap. I think it will be ready in 0.9.7 :slight_smile:

thank you very much for answering.

Doubt it is very important.

Will I be able to do the process I explained before?
I mean, get information from a CPT through a select field, calculate, insert the captured data into another CPT and then display it on another result page? Until displaying the result on another registration confirmation page? (thank you in this case).

a field that I saw here and that you will need to have is the range filter

and confirm if the select can pull data from a CPT and insert it in hidden fields.

Looking forward to the next version!!! :smiley:

2 things you need, in addition to the calculation field to be able to perform the step by step I said:

  1. the select field can pull information from a CPT (I use JetEngine) I tested it here and it is not pulling.
    Scenario: Pull the name of the CPT and then get the results and insert into hide type fields.

  2. webhook: after the whole process, you can send them to a webhook

In blue what will appear to be chosen.
In red what will be inserted in the hidden fields to be used in the calculation field.

Hi Daniela, please remember this forms function.
With Select field and calculate field.

anxious.

Hi Daniele, thanks for the update.

Could you put together a tutorial using this my need? I tried to assemble as I described initially but I couldn’t. I believe it will be able to cover most users’ needs.

I missed the webhook on the form

Hello Daniele, I am still unable to perform this form function.

I need to fill in the hidden fields based on the selected field, where this selected field is a CPT (JetEngine) with pre-registered values.

Can you help me$$?

Since the last version, you can populate select fields from a custom PHP function: Pro Forms – Bricksforge Docs

There you can build the options from your CPT data.

Regarding the populating of the input hidden field: The Bricksforge Panel would be perfect for that: Bricksforge Panel – Bricksforge Docs With the “On Change” event, you can listen for select input changes and automatically fill your hidden input field with the new value of the select field.

If you handle the select field populating, I’ll help you with the Panel part after sending me admin access :wink:

Daniel, I understand. But I’m not a programmer.

Can you implement this possibility in BricksForge? Please!!

How much?$$

I think, especially if you’re willing to pay, to hire someone elsewhere, might get you results faster than trying to get a very specific case natively implemented. Obviously all up to you haha but anybody with decent js skills should be able to set this up fairly quickly :slight_smile:

To populate your select field from a cpt, you can use this as example, the first code part here Images in radio / checkboxes - #2 by manc

Just remove the thumb and replace it with the title in the array. I can post an adjusted version here tomorrow if it’s confusing, just lemme know.

2 Likes

Just re-read your requirements and unless Daniele has a way of adding data attributes to the options, I don’t see how it would be possible to pull in all the values associated with the cpt.

A select with just the cpt names is easy, just not adding those various numbers you’ve got associated to each one. Not enough of a php head to know if there is some filter or hook to do that. Assuming it’s not currently possible, here’s what I’d do:

Instead of just 1 form, I’d split it up into 2 parts:

  • Part 1: Use a queryloop to get your posts and add the associated values as data attributes.
  • Part 2: The form with all the fields and calculation fields except for the cpt selector.

With a little js, on click of one of the posts from Part 1, get all the associated numbers and set the value of the corresponding fields.

To add the attributes you can just add them via bricks, using the corresponding dynamic tags, for example like so:
image

Let’s say your html structure looks something like this

<div class="your-cpt" data-value1="12345" data-value2="3424">title and image or whatever</div>

Setup an event like so:
image

For the action choose the last one “Javascript” and in the JS code field, do something like this:

//Get your values from the clicked post
const value1 = trigger.getAttribute('data-value1');
const value2 = trigger.getAttribute('data-value2');

//Pass the values into the corresponding form fields
document.querySelector('input[name="form-field-name1"]').value = value1;
document.querySelector('input[name="form-field-name2"]').value = value2;

Haven’t properly tested but in theory it should work haha