Skip to Content

dynamic population of dropdown list

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 10, 2014 at 04:51 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.