Hello @asmaahmedd
Thank you very much for using our plugin.
If the equation result is too long text for the calculate field’s box, you can use it as an auxiliary but display its value in another place.
For example, assuming the calculate field’s name is fieldname123.
Insert an “HTML Content” content field in the form and enter a DIV tag in its content with the data-cff-field attribute indicating the name of the field to use:
<div data-cff-field="fieldname123"></div>
The data-cff-field attribute tells the plugin, please display the field’s value as this tag’s content (in this hypothetical case, the value of the calculated field fieldname123).
Finally, as the calculated field is used as an auxiliary, you can hide it by ticking a checkbox in its settings.
Best regards.
Hello,
I have tried the solution you provided, but unfortunately, it doesn’t seem to work. I followed the steps to create a calculated field and an HTML content field with the data-cff-field attribute, but the message is not being displayed as expected. Below is the code I used:
(function(){
var frenchLevel1 = fieldname20;
var frenchLevel2 = fieldname21;
var frenchLevel3 = fieldname22;
var frenchLevel4 = fieldname38;
var englishTest = fieldname25;
var experience = fieldname43;
if ((frenchLevel1 === 'A1' || frenchLevel1 === 'A2' || frenchLevel1 === 'B1') &&
(frenchLevel2 === 'A1' || frenchLevel2 === 'A2' || frenchLevel2 === 'B1') &&
(frenchLevel3 === 'A1' || frenchLevel3 === 'A2' || frenchLevel3 === 'B1') &&
(frenchLevel4 === 'A1' || frenchLevel4 === 'A2' || frenchLevel4 === 'B1') &&
englishTest === 'no' &&
experience === '0 to 6 months') {
return "Le candidat doit améliorer son niveau de français pour obtenir un B2, son niveau d'anglais ainsi qu'il doit améliorer son expérience.";
} else {
return "";
}
})()
Hello @asmaahmedd
Could you please provide the link to the page that contains the form to check your equation in action?
Best regards.
Hi,
Yes, here is the page that contains the calculator : https://explorecanadavisa.ca/quebec/
Hello @asmaahmedd
The URL provided is restricted. Could you please indicate the form ID?
Best regards.
Sorry about that, here is the form URL : https://explorecanadavisa.ca?cff-form=16
Hello @asmaahmedd
Thank you very much.
The current equation in your form is:
(function () {
var message = "";
var field20 = '%fieldname20%';
var field21 = '%fieldname21%';
var field22 = '%fieldname22%';
var field38 = '%fieldname38%';
var field43 = '%fieldname43%';
if ((field20 == 0 || field20 == 32) &&
(field21 == 0 || field21 == 32) &&
(field22 === 0 || field22 === 32) &&
(field38 == 0 || field38 == 32) &&
field43 == 0) {
message = "Le candidat doit...";
} else {
message = "Unfortunately! You have a low chance of being eligible.";
}
console.log("Message to display:", message);
return message;
})();
You must use the fields’ names directly, without single-quotes or percentage symbols.
(function () {
var message = "";
var field20 = fieldname20;
var field21 = fieldname21;
var field22 = fieldname22;
var field38 = fieldname38;
var field43 = fieldname43;
if ((field20 == 0 || field20 == 32) &&
(field21 == 0 || field21 == 32) &&
(field22 === 0 || field22 === 32) &&
(field38 == 0 || field38 == 32) &&
field43 == 0) {
message = "Le candidat doit...";
} else {
message = "Unfortunately! You have a low chance of being eligible.";
}
console.log("Message to display:", message);
return message;
})();
Best regards.