Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:18:27+00:00 2026-06-13T10:18:27+00:00

I encounter some problem when I am trying to copy (non-duplicated) selected content from

  • 0

I encounter some problem when I am trying to copy (non-duplicated) selected content from one listbox to another. I keep getting “Unable to get value of the property : object is null or undefined” exception.

Below are my codes

function CopyItem(from, to) {
    var src = document.getElementById(from);
    var dest = document.getElementById(to);

    for (var i = 0; i < src.options.length; i++) {
        if (src.options[i].selected) {
            var found = false;

            for (var j = 0; j < dest.options.length; j++) {
                if (dest.options[j].value == src.option[i].value) {
                    found = true;
                    break;
                }
            }

            if (!found) {
                var newOption = document.createElement("option");
                newOption.text = src.options[i].text;
                newOption.value = src.options[i].value;
                dest.options[dest.options.length] = newOption;
            }
        }
    }
}

@Html.ListBox("lvDataList", Model.DataList, new { id = "SelectionList", Multiple = "multiple", Size = 15, style = "width: 100%;" })
@Html.ListBoxFor(x => x.SelectedData, Model.SelectedDataList, new { id = "SelectedList", Multiple = "multiple", Size = 15, style = "width: 100%;" })
<input type="button" id="btnAdd" title="Add Selected Events" onclick="CopyItem('SelectionList', 'SelectedList', true)" />

Can someone please explain where did I code wrongly?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:18:28+00:00Added an answer on June 13, 2026 at 10:18 am

    I guess you should have src.options instead of src.option in line

     if (dest.options[j].value == src.option[i].value) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I encounter some issues on trying to calculate distance between one location and a
I've encountered an curious problem while trying to use some objects through JSNI in
I'm trying to learn some basics of Ruby on Rails and encountered a problem
I am trying to use the vote_fu gem and I encounter a problem that
The problem I've encountered after trying to train neural networks isn't a new one
I'm trying to debug some emails that are getting sent to the Spam Folder
I'm programming some websites with JSP-Scripting and I encounterd a strange problem with urlencoded
I am using Flexslider but I've encountered some kind of a problem. It's actually
Pretty sure some people encountered this problem before. Followed all the instructions to setup
These days, we encountered a strange problem, some of our solr apps on tomcat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.