cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic population of dropdown list

shaji_chandran
Participant
0 Kudos

Hi Folks,'

I have  a very common scenario to populate a drop down list according to the selection of parent drop down

For example I need to populate State drop down while selecting country.

I have already achieved this by invoking a MII transaction using Ajax/JSON calls. Transaction will invoke the SQL query and will return the result back to browser.

I am just wondering can't we do this via servlet in MII. I have copied the code below where I am invoking a servlet which will execute the SQL query. But I want to know how can I pass a parameter to the SQL query while invoking servlet. Is there any way to do?

function loadState()

  {

  var svltURL="/XMII/CM/GUI/Common/SERVLET/svltTemplate.irpt";

  var qryActionType="Default/GUI/Queries/sqlGetState";

        $.getJSON(svltURL,{QueryTemplate:qryActionType},function(result) {

             var jsonobj = result;

             for (i = 0; i < jsonobj.aaData.length; i++) {

    var oActionType = document.getElementById("ddnType");

                 var newElement = document.createElement('option');

                 newElement.text = jsonobj.aaData[i][0];

                 newElement.value = jsonobj.aaData[i][0];

                 oActionType.options.add(newElement);

             }

         });

       

Here is the servlet code

<SERVLET NAME="Illuminator">

<HR>

Illuminator Content Here

<HR>

<PARAM NAME= "QueryTemplate" VALUE="{QueryTemplate}">

<PARAM NAME= "Stylesheet" VALUE="/XMII/CM/GUI/Common/XSLT/JQArrayFormat.xsl">

<PARAM NAME="Server" VALUE="{DataServer}">

<PARAM NAME= "Content-Type" VALUE="text/xml">

</SERVLET>

         Thanks

         Shaji

Accepted Solutions (0)

Answers (1)

Answers (1)

swaroop_anasane
Active Contributor
0 Kudos

Hi Shaji,

If you want to assign the parameters to the query directly from applet/servlet tag, you can use

<Param name="Param.1" value={SomeValue}>

For js you can give, document.appletName.getQueryObject().serParam(index,value);

Hope this helps.

Best Regards,
Swaroop