Copy link to clipboard
Copied
I have following code to filter my second list from my list.
It works when user click the dropdown, since onchange event trigger.
I tried to load the data from stored procedure then the onchange event does not trigger, when user need update data then will see whole list without filtering.
I would like to know if it is possible to trigger onchange event when I load data from stored procedure,
Your help and information is great appreciated,
Regards,
Iccsi,
<td><select name="Mylst" id="Mylst">
<cfoutput query="MySP">
<option value="#MySP.MyID#"
<cfif (isDefined("form.MyID") AND form.MyID EQ MySP.MyID)>selected="selected"</cfif>> #MySP.MyName# </option>
</cfoutput>
</select></td>
$("#Mylst").change(function()
{ $.ajax({
type: "GET",
url: 'Mycfc.cfc?method=GetMethod&MyParam='+ jQuery("#MyPrelsty").val(),
dataType: "json",
cache: false,
success: function(data)
{
$('#MySublst option').remove();
$.each(data, function(i, obj)
{
$("#MySublst").append('<option value=' + '"' + data[0] + '"' +'>' + data[1] +
'</option>')
});
}
});
iccsi wrote:
I would like to know if it is possible to trigger onchange event when I load data from stored procedure,
Yes, it is of course possible. The environment in which the event takes place - the browser - is independent of the environment in which data is loaded from the stored procedure - the ColdFusion server.
Any problem you face are probably JQuery ones. A similar question was answered in Stackoverflow.
Copy link to clipboard
Copied
iccsi wrote:
I would like to know if it is possible to trigger onchange event when I load data from stored procedure,
Yes, it is of course possible. The environment in which the event takes place - the browser - is independent of the environment in which data is loaded from the stored procedure - the ColdFusion server.
Any problem you face are probably JQuery ones. A similar question was answered in Stackoverflow.
Copy link to clipboard
Copied
Thanks for the information and help,
Regards,
Iccsi,