Show popup when a specific value is selected in multi select

From SMTX Wiki
Jump to navigation Jump to search

This example shows how you can use "Javascript to execute on asynchronous postback" to trigger on specific values that get selected in a multi selection listbox.

Define this as Javascript to execute on asynchronous postback:

<script type="text/javascript">
var selectedSoftwareArray = document.getElementById('SelectedSoftwareDiv').innerHTML.split("||").filter(function(c) { return c; });
var selectedSoftwareContent = selectedSoftwareArray.join("||");
if (selectedSoftwareArray.length > 0 && document.showedSelectedSoftwareContent !== selectedSoftwareContent) {
document.showedSelectedSoftwareContent = selectedSoftwareContent;
OpenFancyBox("<h3 style='margin-right: 28px'>Information</h3><ul>" + selectedSoftwareArray.map(function(c) { return "<li>" + c + "</li>"; }) + "</ul>", "html", 500, 250, false, null)
}
</script>

Define this as default answer:

<div style="display:none;" id="SelectedSoftwareDiv">#REPLACE-FORMFIELD-FormName||SelectionList||ColumnWithExtraText#</div>