I have a problem in loading the response to the select
tag. I am trying to change the select Box based on the first one.
For this I am using Struts 2 with jQuery Ajax tags. I think I have all required stuff but the response is not tagging to the option but able to see the result in the JS of the view source of a browser.
Below is the code which I have written in JSP.
This is my first select Box:
<div class="type-text">
<s:url id="remoteurl" action="getGlobalManufacturerJquery.action?mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=%{gameFileID}&gameFileName=%{gameFileName}&titleName=%{titleName}&titleID=%{titleID}"/>
<sj:select
href="%{remoteurl}"
formIds="TitleGameHandsetsForm"
id="manufacturerName%{titleGameFilemappingID}"
onChangeTopics="reloadsecondlist"
name="manufacturerName%{titleGameFilemappingID}"
list="%{manufacturers}"
listKey="%{globalManufacturer}"
listValue="%{globalManufacturer}"
emptyOption="true"
headerKey="-1"
headerValue="Select Global Manufacturer"
/>
</div>
And below is my second select box which should be on chaging the first value
<div class="type-text">
<s:url id="remoteurl" action="getGlobalModelJquery.action?mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=%{gameFileID}&gameFileName=%{gameFileName}&titleName=%{titleName}&titleID=%{titleID}"/>
<sj:select
id="globalModel%{titleGameFilemappingID}"
formIds="TitleGameHandsetsForm"
reloadTopics="reloadsecondlist"
name="modelFromSelect"
list="%{modelList}"
emptyOption="true"
headerKey="-1"
headerValue="Select Global Model"
/>
</div>
And in the JSP there is no list available. But the server code is getting results which I can see in the source code of JS which is not able to append to the JSP of select box.
<select name="manufacturerName77" id="manufacturerName77">
<option value=""></option>
</select>
<script type='text/javascript'>
jQuery(document).ready(function () {
var options_manufacturerName77 = {};
options_manufacturerName77.datatype = "json";
options_manufacturerName77.type = 'select';
options_manufacturerName77.emptyoption = true;
options_manufacturerName77.headerkey = "-1";
options_manufacturerName77.headervalue = "Select Global Manufacturer";
**options_manufacturerName77.list = "[Acer, A Panda]";**
options_manufacturerName77.listkey = "Acer";
options_manufacturerName77.listvalue = "Acer";
options_manufacturerName77.jqueryaction = "select";
options_manufacturerName77.id = "manufacturerName77";
options_manufacturerName77.name = "manufacturerName77";
options_manufacturerName77.oncha = "reloadsecondlist";
options_manufacturerName77.href = "/ci/getGlobalManufacturerJquery.action";
options_manufacturerName77.hrefparameter = "mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=3&gameFileName=dcdscd&titleName=Bubble boom chalenge&titleID=11";
options_manufacturerName77.formids = "TitleGameHandsetsForm";
jQuery.struts2_jquery.bind(jQuery('#manufacturerName77'),options_manufacturerName77);
});
</script>
</div>