Complex Fields Dependency
-
I am sharing the recording of the issue….Can you please let me know where I am going wrong?
I have gone through the explanation you have provided here: https://ww.wp.xz.cn/support/topic/applying-dependency-for-calculated-fied-2/
It worked for me..but I think I messed something up.
Can someone please help here?
-
Hello @medhaa
Thank you very much for using our plugin. Please, remove the single line comments from the equations ( Ex. // Pumpkin Seeds). If you want to include comments, use the block format (Ex. /*Pumpkin Seeds*/). The plugin minifies the equations’ code when generate the forms, and the single line comments can break them.
Best regards.
I tried removing the comments and still it doesn’t seem to be working. Actually, it seems to me that the equation in that field is not getting executed. I mean, if I’m adding any other field in the form, it is not displaying on the page.
Here is the recording: https://www.loom.com/share/13153981cfbc4dfe8a1e4cd8712f0491
-
This reply was modified 3 years, 4 months ago by
medhaa.
Hello @medhaa
Your fields fieldname101 and fieldname102 were configured as dependent on the choices in the fieldname7 field.
Please, send me the link to the page that contains the form to check it in action.
Best regards.
My website is not yet public…Is there any other way?
And fieldname101 and 102 were dependent earlier…but now I removed the field, so the dependency will automatically get removed..right?
-
This reply was modified 3 years, 4 months ago by
medhaa.
Hello @medhaa
In this case, you can export the form and send me the .cpfm file.
Please, read the following section in the plugin documentation:
https://cff.dwbooster.com/documentation#import-export-form
Best regards.
I’m not finding the import/export section. Maybe its for pro users.
Please find the form link here: https://medhaagrawal.com/recipe-ingredient-calculator/
Please take a look at this recording where I have tried to explain the issue I’m currently facing: https://www.loom.com/share/8f9a3e32d6464707aca5af3c7da42677
Hello @medhaa
Your form has multiple calculated fields managing custom dependencies and affecting same fields (fieldname101, fieldname139, fieldname138, fieldname137, fieldname136, fieldname135, fieldname134, fieldname133, fieldname132, fieldname131, fieldname130, fieldname129, fieldname128, fieldname127, fieldname126, fieldname125, fieldname124, fieldname123, fieldname122, fieldname121, fieldname120, fieldname119, fieldname118, fieldname117, fieldname116, fieldname115, fieldname114, fieldname113, fieldname112, fieldname111, fieldname110, fieldname109, fieldname108, fieldname107, fieldname106, fieldname105, etc……..)
The equations are evaluated regardless of the calculated fields’ states (active or inactive). Why have you not defined the dependencies with a unique calculated field?
Also, you have opened comment blocks in the equations (
/*) but not closed them (*/).Best regards.
The above mentioned fields are already deleted. Also, can you please indicate the line no. where I have open comments block(/*).
Can you please give a little more detail on what you mean by “Why have you not defined the dependencies with a unique calculated field?”
Is there any way I can share my screen and connect with you directly?
-
This reply was modified 3 years, 4 months ago by
medhaa.
Hello @medhaa
Please note that support does not cover debugging or implementation of user projects. For custom coding services, please contact us directly through the plugin website. (Contact Us).
In some equations you have
/*IGNOREFIELD(fieldname101|n);(like in the equation of the fieldname134 ) and closed them with*\, but the correct closing symbol is*/, with slash, not backslash.Keep in mind the plugin evaluate every equation affected by the modified fields.
For example, if you have the fieldname123 field with the equation:
(function(){ IGNOREFIELD(fieldname1|n); IGNOREFIELD(fieldname2|n); if(fieldname3 == 'A') { ACTIVATEFIELD(fieldname1|n); } })()And the field fieldname321 with the equation:
(function(){ IGNOREFIELD(fieldname1|n); IGNOREFIELD(fieldname2|n); if(fieldname3 == 'B') { ACTIVATEFIELD(fieldname2|n); } })()If the user selects the
Achoice in the fieldname3 field, the plugin evaluates the equation in the fieldname123, and activates the fieldname1 becausefieldname2=='A'is true. But the plugin evaluates the equation in the fieldname321 (it uses the fieldname3 too), and this time, the line of codeIGNOREFIELD(fieldname1|n);hides the fieldname1 again. Since the conditionif(fieldname3 == 'B')is false, the fieldname2 remains hidden too.The correct would be to implement both dependencies in a unique equation:
(function(){ IGNOREFIELD(fieldname1|n); IGNOREFIELD(fieldname2|n); if(fieldname3 == 'A') { ACTIVATEFIELD(fieldname1|n); } else { ACTIVATEFIELD(fieldname2|n); } })()Best regards.
-
This reply was modified 3 years, 4 months ago by
The topic ‘Complex Fields Dependency’ is closed to new replies.