Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to delete jcr value of cq:dialog granite field, when it's hidden ?

Avatar

Avatar
Validate 1
Level 2
kotisyamala
Level 2

Like

1 like

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile

Avatar
Validate 1
Level 2
kotisyamala
Level 2

Like

1 like

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile
kotisyamala
Level 2

02-02-2020

Dear Community

I've a requirement to hide and show two input fields based on selection dropdown, if the input1 is hidden input2 is shown. But the input is already authored the value is shown when the selection changes.

 

Please help me to remove the jcr value of input1 when it's hidden?

 

Thanks,

Koti Syamala

AEM 6.4 authoring granite Sites

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 1
ashish_mishra1
Level 1

Like

1 like

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
ashish_mishra1
Level 1

Like

1 like

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 1
Boost 1
Affirm 1
View profile
ashish_mishra1
Level 1

05-02-2020

You can use this dialog validation code to achieve this. Here, we will be setting either of the input value is null. if another field is selected using the dropdown.

 

(function(document, $, ns) {
    "use strict";

    $(document).on("click", ".cq-dialog-submit", function(e) {
        e.stopPropagation();
        e.preventDefault();

        var $form = $(this).closest("form.foundation-form"),

            selectionDropDown = $form.find("[name='./selectionDropDown']").val(),

            message, clazz = "coral-Button ";

      

        if (selectionDropDown == 'selected-input2') {

            $('[name="./input1"]').val('');
        }
        if (selectionDropDown == 'selected-input1') {
            $('[name="./input2"]').val('');
        }
        $form.submit();
    });
})(document, Granite.$, Granite.author);

 

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 2
kotisyamala
Level 2

Like

1 like

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile

Avatar
Validate 1
Level 2
kotisyamala
Level 2

Like

1 like

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile
kotisyamala
Level 2

17-02-2020

Thanks for the clientLibs solution.

 

Hi Adobe Team, @kautuk_sahni @jbrar @ashish_mishra1 @Jörg_Hoh @smacdonald2008 

 

This is a common use case can we add this as a flag to not to submit if it's hidden in granite type?

Thanks,
Koti.

Avatar

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile
jbrar
Employee

03-02-2020

You can user "granite:hide" property. Check [1] for more details.

 

[1] https://docs.adobe.com/content/help/en/experience-manager-65/developing/components/hide-conditions.h...