Jump to content

Multi Select On Search Page (Submission)


Recommended Posts

Values need to be separated by OR on each listbox.

 

Let's say you have 4 virtual listbox: 1, 3, 4 and 5

 

You need to add 4 more virtual fields to hold the result for each listbox selections. For these we have virtual 6,7,8 and 9. Use the code below in footer.

<script type="text/javascript">
   
      var o_els = new Array("cbParamVirtual1", "cbParamVirtual3","cbParamVirtual4","cbParamVirtual5");   


	for (var j=0;j<o_els.length;j++){
	var fieldName = o_els[j];
	var x1=document.getElementsByName(fieldName);
	x1[0].multiple=true;
					}
									
								
function splitAndParse()
{
	var o_els = new Array("cbParamVirtual1","cbParamVirtual3","cbParamVirtual4","cbParamVirtual5"); 
	var v_result = new Array("cbParamVirtual6", "cbParamVirtual7","cbParamVirtual8","cbParamVirtual9");
	var result = "";
	var cleanResult = "";
	for (var k=0;k<o_els.length;k++){
	result = "";
		var fieldName = o_els[k];
		var y1=document.getElementsByName(fieldName);
	  
    							
	
		for (var i = 0; i < y1[0].length; i++) { 
		if (y1[0].options[i].selected) { 
		result += "\""+y1[0].options[i].value+"\"" + " OR " ; 
} 
} 
	if (result.length > 4) { cleanResult = result.substring(0,(result.length-4)); }
	
	document.getElementById(v_result[k]).value= cleanResult;
y1.value = cleanResult;

}
}

document.getElementById("caspioform").onsubmit=splitAndParse;
</script>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...