Multiple dependent selects in a table - variables/inputs not honored for server connect load

I have a form that I need to link to multiple tables. For some reason, the server connect isn’t recognizing variables correctly. (It works the second time, not the first time when accessing the api.)

column 1: select box populated from server connect API (works)
column 2: another select box

for column 2, I’ve tried a ton of !@#$ to get this to work.

The only way I could get this to work was to use javascript to set the server control variable directly

Here’s the code that I’m using in my javascript:

	<script>
	function set_action_id(obj){
		debugger;
		index = obj.bindings.$index.value;
		val=obj.data.value;
        //tried setting hidden fields- that didn't work...
		document.all['txt_action_id'].value=val; 
		document.all['txt_action_index'].value=index;
		
		dmxComp=document.all['sc_get_action_type'].dmxComponent;
		dmxComp.props.params['action_id']=Number(val);
		dmx.parse('sc_get_action_type.load()');

		
	}

	function load_ddl(){
		debugger;
		var index=Number(document.all['txt_action_index'].value);

		sel=document.all['sel_action_type'][index];
		var options = document.all['sc_get_action_type'].dmxComponent.data.data.query_get_action_types_by_action_id;
		sel.innerHTML="";

		for(i=0;i<options.length;i++)
		{
			var opt = document.createElement('option');
			opt.value = options[i].option_table_name;
			opt.text=options[i].name;
			sel.appendChild(opt);
		}
	}
</script>

In my server connect, I tried setting the parameter to a variable and using that. I also tried using a hidden field. None of these worked. Trying to figure out why these values aren’t being recognized when the server control is loaded. Is there a better way to do this?

Community Page
Last updated: