Home > WebEOC > Admin Guide > Board Building Tips > Conditionally Send Datalinks Based on Value

Conditionally Send Datalinks Based on Value

Table of contents
No headers

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.

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

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

<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>
You must to post a comment.
Last modified

Tags

Classifications

This page has no classifications.