CodePeople2
Forum Replies Created
-
Hello @msedighiyan86
Thank you very much for using our plugin, and I apologize for the inconvenience. We replied to your email from the plugin website.
Please note we are not allowed to support any customers in these forums.
For pro or commercial product support please contact us directly on our site.
Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.
Thank you.
Forum: Plugins
In reply to: [Calculated Fields Form] Show only 1 image and it’s phraseForum: Plugins
In reply to: [Calculated Fields Form] Help with Conditional Product Pricing FormulaHello @sturgulster
Thank you very much for using our plugin. The equation code will depend on your business logic.
I’ll try to describe the process with a hypothetical example.
Assuming you plan to sell tiles and want to enable users to input the room’s length and width, each box of tiles covers 2 square meters and is priced at $25. Based on the dimensions provided by the user, you will calculate the number of tile boxes needed for their project, as well as the total cost. Additionally, if the project requires more than five boxes, a 10% discount will be applied to the final price.
First, insert two number fields for width and length. I’ll call them fieldname1, and fieldname2.
Second, insert a calculated field to calculate the number of boxers (fieldname3). In this case, the equation needs to calculate the area to cover, and divide it by the area covered by the tile box:
CEIL(fieldname1*fieldname2/2)Finally, insert the calculated field that calculates the project’s cost. It will use the quantity calculated by the previous field and apply the discount if proceeds:
PREC(fieldname3*25*IF(5<fieldname3, 0.9, 1), 2)The PREC(X, Y) rounds the number X with Y decimals. Since the result is a currency, we want to round it with two decimals.
I used two calculated fields to give the users additional information like the number of boxes required for their projects. However, if you want to calculate the price only, you can implement the process with a unique calculated field, and the equation could be implemented as follows:
(function(){
let quantity = CEIL(fieldname1*fieldname2/2);
return PREC(quantity*25*IF(5<quantity, 0.9, 1), 2);
})()Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Hours to daysHello @svd89
You cannot include mathematical operations in the date/time fields’ settings, but you can do it by using a calculated fields as an auxiliary.
Assuming your date/time fields’ values have the format “mm/dd/yyyy hh:ii”, you can insert a calculated field to be used as an auxiliary (you can hide it by ticking a checkbox in its settings) and enter the equation:
(function(){
let d1 = DATEOBJ(fieldname1), d2 = DATEOBJ(fieldname2);
d1.setHours(d1.getHours()+2);
if (d2 < d1){
getField(fieldname2|n).setVal(GETDATETIMESTRING(d1, 'mm/dd/yyyy hh:ii'));
}
})()If your date/time fields have a different date/time format, you must replace
mm/dd/yyyy hh:iiin the equation with the corresponding one.Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Show only 1 image and it’s phraseHello @needfeed
I apologize for the delay in getting back to you. I’ve identified the cause of the issue and released a plugin update to resolve it. Please install the latest update and clear both the website and browser caches before testing the form again. Additionally, I would appreciate it if you could let me know whether the issue has been resolved on your end. Thank you!
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Is it possible to calculate with ‘choice texts?’Hello @svd89
You only need to return the equation result with the tags and the styles you prefer, just like you did in your equation. E.g.
(function(){
if(fieldname104|v == 'A1 Autotransporter') return '<b>This is a <span style="color:red;">test</span></b>';
if(fieldname104|v == 'A2 Autotransporter (luchtgeveerd)') return '<p>another <u>test</u></p>';
if(fieldname104|v == 'B1 Bagagewagen') return '<h4>final test</h4>';
})()The result will be rendered as HTML in the HTML Content field where you inserted the tag with the
data-cff-fieldattribute.I recorded a video emulating your form, and the different variants to teach you the result:
https://resources.developers4web.com/cff/tmp/2024/12/21/video-form_o.mp4
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Is it possible to calculate with ‘choice texts?’Hello @svd89
The calculated fields display the results in input tags, and in the HTML standard input tags do not render other HTML tags. So, you must use the calculated field as an auxiliary to determine the result, but display it in another field.
Assuming your calculated field is the fieldname123, insert an “HTML Content” field in the form and enter a tag in its content with the data-cff-field attribute telling the plugin the field whose value you want to display in the tag. E.g.
<span data-cff-field="fieldname123"></span>Since the calculated field is used as an auxiliary you can hide it by ticking a checkbox in its settings.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] How to repair a corrupt field?Hello @tooni
The issue could be related with an optimizer plugin. So, we now check if some symbols were replaced or removed and fix them.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] How to repair a corrupt field?Hello @tooni
I apologize for the inconvenience and the delay in responding to your question. I noticed that your form has some broken characters. Could you please install the latest plugin update and clear the website and browser caches before checking again?
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] How to repair a corrupt field?Hello @tooni
Could you please provide the link to the page containing the form and indica the field’s name?
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Is it possible to calculate with ‘choice texts?’Hello @svd89
Yes, you can. However, in Javsacript the plain texts must be enclosed between single or double quotes. So, the correct code would be:
(function(){
if(fieldname104|v == 'A1 Autotransporter') return 'This is a test';
if(fieldname104|v == 'A2 Autotransporter (luchtgeveerd)') return 'another test';
if(fieldname104|v == 'B1 Bagagewagen') return 'final test';
})()Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Summary fieldHello @ohtusabes
I apologize for the delay in responding to your question. I’ve been busy working on a plugin update to simplify the process for you.
Please install the latest plugin update and follow the steps below:
- Insert an “HTML Content” field in the form
- Tick the ” Accept advanced code in content as JavaScript code” checkbox in its settings.
- Finally, enter the following code as its content:
<script>
fbuilderjQuery(document).on('formReady', function(){
fbuilderjQuery('[vt]').each(function () {
let e = fbuilderjQuery(this);
e.attr('vt', CONCATENATE(e.attr('vt'), ' (', e.val(),')'));
});
});
</script>4. Finally, tick the “Choices Texts” option for the “Value to Submit” attribute in the checkbox, radio button, or dropdown field.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Days from future date returns dateHello @jhnpldng
The result is correct, but you want the output in the mm/dd/yyyy format instead of dd/mm/yyyy. So, you need only to modify the second parameter in the CDATE operation:
CDATE(fieldname3-fieldname2, 'mm/dd/yyyy');Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Summary fieldHello @ohtusabes
I’m not sure about your question. The Summary control displays both, the field label or title, and the information the field would send to the server when the form is submitted.
For instance, if you are using a Single Line Text control, a Number field, a Calculated Field, or any other control that features an input box, the value will directly reflect the information entered by the user or the calculated result. Conversely, in controls that offer multiple choices—such as radio buttons, checkboxes, and dropdown fields—you have the ability to determine the information that will be submitted. This is done through the settings of the fields, allowing you to specify whether the submitted data will consist of the choices’ labels or values. This selected information will then be displayed in the summary control.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Erratic calculationsHello @ohtusabes
In JavaScript the plus (+) operator is overloaded, it is used to add numbers or concatenate texts, and the concatenation takes precedence. To avoid ambiguity, I recommend to use the SUM operation in the plugin:
SUM(3,2,1,0,0)Best regards.