Hello @rui9075918
I’m not sure to understand your description. When you configure fields as dependent on a checkbox or radio button choices, these fields would be active (and visible) only when the corresponding choices are ticked. The values of the dependent fields are handled as zero by the equations when they are inactive. So, the dependencies not only show/hide fields, the dependency activate/deactivate fields and their values in the equations.
Best regards.
I will try to explain myself better.
I have a dropdown (dropdown1) with three choices (choice1, choice2, choice3).
Choice 1 has no dependencies.
Choice 2 has a dependency (dependency1).
Choice 3 has a dependency (dependency2).
The fieldsets of dependencies 1 and 2 each have another dropdown (dropdown 2 and dropdown 3);
When selecting values in these two dropdowns, they are selected regardless of whether they are visible or not, depending on the choice of dropdown1.
It is here that the problem related to choice2 arises. When selecting choice2 again after selecting choice3, the value in dropdown2 does not work in the function.
However, if I select choice2 -> choice3 -> choice1 -> choice2, the function will already assume the value in dropdown2. This is as described in the previous question.
If I change the order of dependencies in dropdown1, there is always the problem in the position of choice2.
Best regards.
Hello @rui9075918
Could you please indicate the link to the page that contains the form and the fields’ names to check the issue in detail?
Best regards.
Of course, follow the link https://loja.molduraria.pt/?page_id=42
You must click on “Escolha o Passpartout” and what I refer to as dropdown1 is what appears.
Hello @rui9075918
Ok, it is the fieldname52 field, and it has the dependent fields:
fieldname53 is dependent on the “Com Passpartout” choice, and fieldname54 on the “Com Passpartout duplo.”.
These fields are activated if the user selects the second or third choice in the fieldname52. But if he selects the first choice, the values of the contained fields (Ex. fieldname30) are managed as zero by the equations.
I’m testing your form, and it works fine. Each time I select a different option from the fieldname52 field, the plugin evaluates the equations that use the fieldname30 field.
Best regards.
Thanks for the quick response.
But by selecting “with passpartou” or “with double passpartu”. It will change the image on the left side. When selecting “with passpartout” for the first time, it assumes the value of field 30. But if you later select “with passpartoudouble” and select “with passpartout” again, it will not assume the value of field30. Can you test as I indicated?
Hello @rui9075918
I tested your form, and the image is updated correctly. Please, watch the video by visiting the following link:
https://resources.developers4web.com/cff/tmp/2023/03/27/video_o.mp4
Best regards.
It must move from the third choice to the second. And not from the third to the first. The problem is when you go from the third to the second. If you go from any one to the third it always works. Can you test as I indicate?
Hello @rui9075918
The issue is simple. You have created an ambiguity with the equations in the fieldname34 and fieldname82 because both are evaluated when you select a different option from the fieldname52. You need only one field (So, you can delete the fieldname82), and edit the fieldname34 equation as follows:
(function () {
var css = {
'padding': '0px'
},
css2 = {
'clipPath': 'none'
};
if (fieldname52 == 1) {
switch (fieldname30) {
case 0:
css['padding'] = '0px';
break;
case 4:
css['padding'] = '10px';
break;
case 5:
css['padding'] = '12px';
break;
case 6:
css['padding'] = '14px';
break;
case 7:
css['padding'] = '16px';
break;
case 8:
css['padding'] = '18px';
break;
case 9:
css['padding'] = '20px';
break;
case 10:
css['padding'] = '22px';
break;
default:
css['padding'] = '0px';
break;
}
} else if (fieldname52 == 2) {
switch (fieldname69) {
case 0:
css['padding'] = '0px';
css2['clipPath'] = 'inset(0px 0px 0px 0px)';
break;
case 4:
css['padding'] = '10px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 5:
css['padding'] = '12px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 6:
css['padding'] = '14px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 7:
css['padding'] = '16px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 8:
css['padding'] = '18px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 9:
css['padding'] = '20px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
case 10:
css['padding'] = '22px';
css2['clipPath'] = 'inset(5px 5px 5px 5px)';
break;
default:
css['padding'] = '0px';
css2['clipPath'] = 'inset(0px 0px 0px 0px)';
break;
}
}
jQuery('#image-preview-frame').each(function () {
jQuery(this).css(css);
});
jQuery('#image-preview').each(function () {
jQuery(this).css(css2);
});
})();
Best regards.
Good morning,
That was the problem, I didn’t make that hypothesis, for which I must apologize to you. Once again thank you very much for your quick help.
Best regards