• Resolved rui9075918

    (@rui9075918)


    Good afternoon,

    I have a dropdown with 3 choices.
    The first choice has no dependencies.
    The second and third have dependencies.
    Dependencies work well depending on the choice made. Reveal the intended fieldsets. These fieldsets have values ​​used in functions entered in calculatedfields.

    However, the fieldset values ​​dependent on the second choice are not assumed in the function if I first select the third choice from the dropdown.
    If the selection order in the dropdown is:

    • 3rd choice -> 2nd choice, doesn’t work.
    • 2nd choice, it works.
    • 2nd choice -> 3rd choice -> 2nd choice, doesn’t work.
    • 2nd choice -> 3rd choice -> 1st choice -> 2nd choice, it works.

    If I change the order of the dependencies in the dropdown the problem always remains in the 2nd choice.
    Is there a reason for this? can it be fixed?

    Best regards.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter rui9075918

    (@rui9075918)

    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.

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter rui9075918

    (@rui9075918)

    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.

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter rui9075918

    (@rui9075918)

    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?

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter rui9075918

    (@rui9075918)

    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?

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter rui9075918

    (@rui9075918)

    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

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Dropdown and dependencies’ is closed to new replies.