Hello @zxpw
Could you please indicate the URL to the page that contains the form to check the issue in detail?
Best regards.
Hello @zxpw
My apologies. Yes, the module that manages the additional shortcode attributes changed. Previous plugin versions generated global Javascript variables with additional shortcode attributes, but it has a problem. It overwrites other global variables that can be used by third-party plugins or the theme active on your website.
The latest plugin versions generate the cff_var object, whose properties are the additional shortcode attributes.
So, the code to use the shortcode attributes from the equations needs to be edited as follows:
(function(){
if('cff_var' in window && 'first_attr' in cff_var) getField(fieldname1|n).setVal(cff_var.first_attr);
if('cff_var' in window && 'second_attr' in cff_var) getField(fieldname2|n).setVal(cff_var.second_attr);
if('cff_var' in window && 'third_attr' in cff_var) getField(fieldname3|n).setVal(cff_var.third_attr);
})()
Best regards.
Hello,
Your equation should be edited as follows:
(function () {
if('cff_var' in window) {
if('spend' in cff_var) getField(fieldname21|n).setVal(cff_var.spend);
if('programme' in cff_var) getField(fieldname17|n).setVal(cff_var.programme);
if('bonus' in cff_var) getField(fieldname20|n).setVal(cff_var.bonus);
}
})()
Best regards
Thread Starter
zxpw
(@zxpw)
Thanks for the quick response. Unfortunately, any time I try to apply the changes, it is blocked by my host’s firewall.
Hello @zxpw
Please configure the firewall rules properly. That is a false positive of the security rules on your server.
Best regards.
Thread Starter
zxpw
(@zxpw)
I’ve spoken to my host and they’ve told me that it’s likely being blocked because of: Immediately Invoked Function Expressions (IIFEs), Obfuscated Code or Unusual Variable Names.
Is there possibly another way to write the code to avoid this problem?
Hello @zxpw,
None of the assumptions are met in this case. The plugin generates the variables as follows:
if( ! ( "cff_var" in window ) ) window["cff_var"] = {}; window["cff_var"]["variable_name"]='variable_value';
This code is not obfuscated, and the variable names are not unusual.
Best regards.
Thread Starter
zxpw
(@zxpw)
I managed to get it working with some slight modifications:
if (window.cff_var) {
if ('spend' in cff_var) getField(fieldname21|n).setVal(cff_var.spend);
if ('programme' in cff_var) getField(fieldname17|n).setVal(cff_var.programme);
if ('bonus' in cff_var) getField(fieldname20|n).setVal(cff_var.bonus);
}
Can you foresee any issues with this approach?
Hello @zxpw
Your code is correct. As you can see, you have modified only one piece of code. You replaced the line of code below:
if('cff_var' in window)
With this piece of code:
if (window.cff_var) {
Both are equivalent and evidence that your hosting rules classify valid code as potentially dangerous for no reason.
Best regards.
Thread Starter
zxpw
(@zxpw)
Yes it does seem like their rules are a bit overzealous. Nevertheless, I am glad a solution has finally been found.
Thank you so much for your help and patience. It’s much appreciated.