Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

listeners

Avatar

Level 4

1.Based on condition i fired alert from Jsp, alert working properly, control is not stop after that.

<script type="text/javascript">

                        alert("value Exist");

                        return false; // Control is not returning from here, 

  </script>

2. I gave listener in dialog, to trigger alert, it's working and control stop there itself.

but each and every time am getting alert.

In Jsp:

<script type="text/javascript">

function alerting(dialog){

                       alert("value Exist");

                     }

                </script>

In dialog.xml i gave

 <listeners jcr:primaryType="nt:unstructured"

    beforesubmit="function(dialog){alerting(dialog); return false;}"/> --> am getting alert in all the times, when i press ok.

 

Please, guide me to get alert when condition satisfied.not on all the times.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You have used beforesubmit listener in your dialog which executes everytime you are trying to submit the dialog. When this listerner is called you method executes.

If you want to perform some validation, then please return false,  only in case where you do not want user to submit the dialog and he should input correct values.

else return true if your validation are fine and you are happy with the input values.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

You have used beforesubmit listener in your dialog which executes everytime you are trying to submit the dialog. When this listerner is called you method executes.

If you want to perform some validation, then please return false,  only in case where you do not want user to submit the dialog and he should input correct values.

else return true if your validation are fine and you are happy with the input values.