Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Poppulate dialog fileds on the page properies based on the response of the servlet.

Avatar

Level 2

Hi All,

 

I have a requirment like, when we select a value in drop down a servlet call will be triggered and based on the respone of the call I have to show th fields on the page which are dynamic and when we reedited the page it has to dispaly previous selected data as well.

Can anyone suggest how can we achive this. 

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Community Advisor

Hi @naresh5361 ,

You can achieve this through ajax call along with custom JavaScript based on dialog ready, which is responsible to get response from servlet. 

some sample code snippet as below

<script>
$.ajax({     
	type : "POST",     
    	url : '/bin/submitdata',     
        /*data : {         
        pass your request parameter here, currently we are not passing any data     
        },*/     
        success : function(data, textStatus, jqXHR) {         
        //write your logic that you need to perform on sucess                           
        },     
        error : function(XMLHttpRequest, textStatus, errorThrown) {         
        //write your logic that you need to perform on error     
        } 
        });
</script>

Also please go through below link: https://www.youtube.com/watch?v=H3xV4S8aq5k

Hope that helps!

Regards,

Santosh

Avatar

Level 2

Hi @SantoshSai ,

 

I want to show dialog feilds based on the servlet response.

Example below :

{
"property-title1":  {
"checkbox": "value",
"checkbox": "value"
},
"property-title2":  {
"checkbox": "value",
"checkbox": "value"
},
"property-title3":  {
"checkbox": "value",
"checkbox": "value"
}
}

I have to show like below.

property-title1 

  •  title
  • name

property-title2

  •  title
  • name

this json is coming from servlet respone and this data is very huge and dynamic. i want this to be dispalyed when we select some value in dropdown.  

hope you understand. 

 

thanks.

 

 

Avatar

Correct answer by
Community Advisor