codepeople
Forum Replies Created
-
Forum: Plugins
In reply to: [Calculated Fields Form] Dynamically evaluate not working since updateHello @brihen
Could you please provide the link to the page that contains the form to check it in action? The editor in the WordPress forum is modifying the pieces of code in your entry.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] shortcode dont workHello @smalavi06gmailcom
The CFFCHART operation is a proxy for the ChartJS library. So, it can generate every chart supported by ChartJS (including line charts):
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Setting up a Reply-To?Hello @supervinnie41
What plugin version have you installed? The “Email Copy toUser ” section is available in the plugin commercial distributions:
https://cff.dwbooster.com/documentation#copy-user
Best regards.
Hi,
That’s probably a “JavaScript optimization” breaking the scripts in the page. Check if you have some plugin applying a JavaScript optimization (like for example WPRocket) and try temporary deactivating the optimization or excluding the page from the optimization to confirm that it is the cause of the problem.
Thank you for using the plugin!
Forum: Plugins
In reply to: [Calculated Fields Form] shortcode dont workHello @smalavi06gmailcom
If you want to generate charts with the form information, you can use the CFFCHART operation distributed with the plugin Developer and Platinum versions.
Learn more about the CFFCHART operation by reading the following blog post:
https://cff.dwbooster.com/blog/2019/05/27/charts
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] shortcode dont workHello @smalavi06gmailcom
Thank you very much for using our plugin.
Could you please insert the shortcode with the iframe attribute as follow?
[CP_CALCULATED_FIELDS id="8" iframe="1"]If the issue persist, please provide the URL to the page that contains the form.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Setting up a Reply-To?Hello @supervinnie41
Thank you very much for using our plugin. In the current plugin version, the reply-to header in the notification email will correspond to the value of the email address selected through the “Email field on the form” attribute in the “Email Copy to User” section of form settings. Please note the “Email field on the form” attribute is a multi-select list, you must select the field from the list explicitly.
Best regards.
Hello @gibbonh
Thank you very much for using our plugin. In this case, the alternative is to use the calculated field as an auxiliary field but display the result in another control.
Please insert an “HTML Content” field in the form and enter a DIV, P, or another tag in its content with the
data-cff-fieldattribute indicating the field to display into the tag. Ex:<div data-cff-field="fieldname10"></div>Since the calculated field is used now as an auxiliary field, you can hide it by ticking a checkbox in its settings.
Best regards.
Hello @redfoxbuilders
Your form looks really good. Congratulations !!!. Thank you very much for sharing your form.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Send EmailHello @itzikn,
You can enter the
<%from_page%>tag in the “Thank you page” attribute in the form settings.But if you prefer to submit the form in the background and display a text directly in the form, you will need the commercial plugin version.
Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Add months to date fieldHello @lauraabraham
Thank you very much for using our plugin. I’ll try to describe the process with a hypothetical example.
Assuming you have the date field, fieldname1 with date format “mm/dd/yyyy” (the date format is selected through the field’s settings), and you want to increase it in one month.
Insert a calculated field in the form and enter the equation:
GETDATETIMESTRING(DATETIMESUM(fieldname1, 'mm/dd/yyyy', 1, 'm'), 'mm/dd/yyyy')You must read the DATETIMESUM operation as follows: take the fieldname1 value in ‘mm/dd/yyyy’ format and increase it in one month (
'm'). The operation returns a date object, but as you want to display it into a calculated field, you must use the GETDATETIMESTRING operation to transform the object into a text with date/time format, in this case,'mm/dd/yyyy'.Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Cumulative Layout ShiftHello @buptrick
The plugin estimates the form height to avoid CLS or reduce its impact. However, as you have cached the webpage with the “WP Fastest Cache” plugin, your website loads a page’s copy from the cache with outdated height. Please purge the “WP Fastest Cache” and browser’s cache and re-visit the webpage to allow the plugin to recalculate the height and “WP Fastest Cache” to create a cached copy of the webpage with the correct height value.
Best regards.
Hello @redfoxbuilders
There are some issues in your equation. I see you removed the plain objects that use the choices’ texts, also, you are using extra code for no reason. The equation would be much simpler.
First, you must understand the use of modifiers in the fields’ names. Radio buttons, Checkboxes, and Dropdown fields allow you to select the information to submit and include in the notification emails through their attributes “Value to submit” (the possible options are the choices’ texts or choices’ values). For these controls, you can use the |v modifier with their fields’ names to access the information to submit to the server Ex. fieldname16|v. If you want to access the choices’ values from the equations, use simply fieldname16.
If the radio buttons, checkboxes and dropdown fields do not have choices selected, the plugin treats their values as zero, you don’t need to include conditional operations or parseFloat.
So, the piece of code:
var bedrooms = parseFloat(fieldname16|v) || 0;
var bathrooms = parseFloat(fieldname47|v) || 0;
var propertyType = parseFloat(fieldname18|v) || 0;
var occupied = parseFloat(fieldname17|v) || 0;
var additionalRooms = fieldname20|v || [];
var extraPainting = fieldname21|v || [];
var doors = parseInt(fieldname25|v) || 0;
var windows = parseInt(fieldname29|v) || 0;
var repairs = parseFloat(fieldname22|v) || 0;
var congestionZone = parseFloat(fieldname44|v) || 0;
var parkingAvailable = parseFloat(fieldname45|v) || 0;would be:
let bedrooms = fieldname16,
bathrooms = fieldname47,
propertyType = fieldname18,
occupied = fieldname17,
additionalRooms = fieldname20|v || [],
extraPainting = fieldname21|v || [],
doors = fieldname25,
windows = fieldname29,
repairs = fieldname22,
congestionZone = fieldname44,
parkingAvailable = fieldname45;Now, about additionalRooms (fieldname20), and extraPainting (fieldname21)
Checkboxes include the “Merge ticked up options (sum or concatenation) or their values are returned as an array.” in their settings. If the checkbox is ticked, the plugin sums by itself the values of ticked choices, otherwise the field’s value would be an array with the values of ticked choices.
So, by unticking these choices in the fieldname20 and fieldname21, the lines of code:
additionalRooms = fieldname20|v || [],
extraPainting = fieldname21|v || [],Would be only:
additionalRooms = fieldname20,
extraPainting = fieldname21|v,The piece of code below is unnecessary:
if (additionalRooms.length > 0) {
for (var i = 0; i < additionalRooms.length; i++) {
totalPrice += parseFloat(additionalRooms[i]) || 0;
}
}Using the plugin operations, the previous code can be rewritten as follows:
totalPrice += SUM(additionalRooms);Something similar occurs with the code:
if (extraPainting.includes("80")) totalRooms += 1;
if (extraPainting.includes("40")) totalRooms += 1;totalRooms += IF(IN(80,extraPainting),1,0);
totalRooms += IF(IN(40,extraPainting),1,0);Concerning the #### symbols in the phone fields, their selector is
#fbuilder .land you can hide them via the “Customize Form Design” attribute in the “Form Settings > Advanced Settings” tabs. More information about customizing the form design by watching the following video:Best regards.
Forum: Plugins
In reply to: [Calculated Fields Form] Send EmailHello @itzikn
Thank you very much for using our plugin. You can include every field’s value submitted by the form in the notification emails. However, the “HTML Content”, “Media”, and “Instruct. Text” fields are not submittable. If you want to include any of this information in the form, you must enter it directly in the “Message” attribute in the “Form Processing/Email Settings” section of form settings (https://cff.dwbooster.com/documentation#email-settings)
Learn more about the fields and informative tags supported by the notification emails by reading the following section of the plugin documentation:
https://cff.dwbooster.com/documentation#special-tags
Best regards.
Hello @redfoxbuilders
Please remove the online comments from the equations code. The plugin minifies the equations code, and the online comment can break the resulting equations. If you want to include comments in the equations, please use block structure Ex.
/* Calculate extra painting cost */The second issue is caused by the use of fields’ names. The plugin replaces the fields’ names with their corresponding values before evaluating the equations. You should not do it yourself.
So, pieces code like:
var repairs = getField('fieldname22').val();Must be transformed into:
var repairs = fieldname22;So, the equation structure would be similar to:
(function () {
var baseAmount = 300;
var totalPrice = baseAmount;
var bedrooms = fieldname16|v;
var bathrooms = fieldname47|v;
var propertyType = fieldname18|v;
var occupied = fieldname17|v;
var additionalRooms = fieldname20|v;
var extraPainting = fieldname21|v;
var doors = fieldname25;
var windows = fieldname29;
var repairs = fieldname22;
var congestionZone = fieldname44;
var parkingAvailable = fieldname45;
var bedroomPrices = {
"0 Bedroom": 0,
"1 Bedroom": 0,
"2 Bedroom": 120,
"3 Bedroom": 260,
"4 Bedroom": 450,
"5 Bedroom": 630,
"6 Bedroom": 800
};
totalPrice += bedroomPrices[bedrooms];
var bathroomPrices = {
"0 bathroom": 0,
"1 bathroom": 130,
"2 bathroom": 250,
"3 bathroom": 350
};
totalPrice += bathroomPrices[bathrooms];
var propertyPrices = {
"Flat": 0,
"Terrace": 0,
"Semi-Detached": 50,
"Detached": 50,
"Other": 0
};
totalPrice += propertyPrices[propertyType];
var occupiedPrices = {
"Yes": 50,
"No": 0
};
totalPrice += occupiedPrices[occupied];
var additionalRoomPrices = {
"Living Room": 180,
"Kitchen": 110,
"Bathroom": 110,
"Hallway": 150,
"Stairwell & Landing": 140
};
if (additionalRooms) {
for (var i = 0; i < additionalRooms.length; i++) {
totalPrice += additionalRoomPrices[additionalRooms[i]];
}
}
var numBedrooms = parseInt(bedrooms.charAt(0)) || 0;
var numBathrooms = parseInt(bathrooms.charAt(0)) || 0;
var ceilingCost = 80 * (numBedrooms + (additionalRooms ? additionalRooms.length : 0) + numBathrooms);
var skirtingBoardCost = 40 * (numBedrooms + (additionalRooms ? additionalRooms.length : 0) + numBathrooms);
var extraPaintingCosts = {
"Ceiling": ceilingCost,
"Skirting Board": skirtingBoardCost
};
if (extraPainting) {
for (var j = 0; j < extraPainting.length; j++) {
totalPrice += extraPaintingCosts[extraPainting[j]];
}
}
totalPrice += 45 * parseInt(doors);
totalPrice += 35 * parseInt(windows);
var repairPrices = {
"No repairs": 0,
"small repairs": 50,
"medium repairs": 110,
"major repairs": 220
};
totalPrice += repairPrices[repairs];
var congestionZonePrices = {
"Yes": 15,
"No": 0
};
totalPrice += congestionZonePrices[congestionZone];
var parkingPrices = {
"Yes": 0,
"No": 15
};
totalPrice += parkingPrices[parkingAvailable];
return totalPrice;
})()Please note I’m not debugging your code, only analyzing the equation’s structure. If you need us to implement your equation, you can contact us directly through the plugin website. Contact Us