Jump to content

Recommended Posts

Would you be able to help me figure out what I'm doing incorrectly.

I have a cascading drop down in a submission form that has multiselect enabled (Services).

What I want it to do, is that the values of the selected service, be copied to the Description Field as values separated by a comma.

Here is the scripts I'm using. It just generates a value of "undefined," so I know something is wrong, but I can't figure out what. Any help is greatly appreciated.

 

 

var x=document.getElementsByName("InsertRecordServices");

x[0].multiple=true;

document.getElementsByName("InsertRecordServices")[0].onblur = function ()

{

document.getElementById("InsertRecordDescription").value = document.getElementsByName("InsertRecordServices").value;

}

Link to comment
Share on other sites

Add the code below to the header of the page:

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script>

window.onload = function multiselect() {

var a = document.getElementsByTagName('select');

var index;

for (index = 0; index < a.length; ++index) {

          if (a[index].size!==0) {

    a[index].multiple=true;

          }

}

}

</script> 

 

And this code to the Footer

 

<script>

$('[name=InsertRecordServices]').change(function() {

$('[name=InsertRecordDescription]').val($('[name=InsertRecordServices]').val())

});

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