Conditionally Send Datalinks Based on Value

Use the following code to conditionally send datalinks based on the value chosen from a drop-down list.

Use the <datalink> tag to display the datalink on the input view. Hide it with the <span> tag.

Copy Code
<span style="display:none;"><datalink name="nameofdatalink"/></span>

Then, add the below block of JavaScript to your input view.

Copy Code
<script type="text/javascript">
function checkDatalink()
{
var theDropDown = document.forms[0].nameofdropdown;
if(theDropDown.options[theDropDown.options.selectedIndex].text == 'whatever you're checking for')
{
document.forms[0].datalinkid.checked = true;
}
}
function SetSubmitHandler()
{
document.forms[0].onsubmit = checkDatalink;
}
window.onload = SetSubmitHandler;
</script>