Jump to content
  • 0

Display Selected Options in Other Field of the Same Form


deemuss

Question

1 answer to this question

Recommended Posts

  • 0

Hi @deemuss

You may use this code to implement such a workflow:

<script type="text/javascript">
function inputHandler(event) {
 console.log(event);
 var options = event.target.childNodes
 var selectedOptions = '';
 for(let i = 0; i < options.length; i++) {
  if (options[i].selected) {
   selectedOptions += `${options[i].value}, `;
  }
 }
 document.getElementById('cbParamVirtual1').value = selectedOptions.substring(0, selectedOptions.length - 2); // Here you may change the ID (cbParamVirtual) of needed input to insert the value of the choosen elements
}

function assignEvent() {
 var elem = document.getElementById('InsertRecordtext');
 elem.multiple = true;
 elem.addEventListener('input', inputHandler);
 document.removeEventListener('DataPageReady', assignEvent);
}

document.addEventListener('DataPageReady', assignEvent);
</script>

You will have the option to multi-select elements from list box with ctrl button pressed.
The only thing you need to change is the input to insert the chosen values.

This code needs to be inserted into the header of the submission form. Do not forget to disable the HTML editor in the advanced section.

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
Answer this question...

×   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...