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

  • SEARCH
  • Home
  • 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 6685149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:01:31+00:00 2026-05-26T05:01:31+00:00

I have a Javascript function for my select box, but after I included runat=server

  • 0

I have a Javascript function for my select box, but after I included runat=”server” to it, the script debugger highlights on this line below:

‘ for (i = 0; i < sourceTo.options.length; i++) { ‘ and says:

SCRIPT5007: Unable to get value of the property ‘length’: object is null or undefined

I included it because I wanted to loop through it in code behind and perform some other stuffs, please advice thanks!

Code:

    <select multiple size="8" style="width: 135px" runat="server" id="outletFromBox">
                                               <option value="JP">Jurong Point</option>
                                               <option value="IMM">IMM</option>
                                               <option value="Wisma">Wisma</option>                
                                           </select> 
                                       </td>

                                       <td align="center" valign="middle">
                                           <input type="button" class="ui-icon ui-icon-arrowthick-1-e ui-corner-all" style="width: 20px; height: 23px;" onClick=" javascript:move(('outletFromBox'),('outletToBox')); " 
                                                  value=""><br />
                                           <input type="button" class="ui-icon ui-icon-arrowthick-1-w ui-corner-all" style="width: 20px; height: 23px;" onClick=" javascript:move(('outletToBox'),('outletFromBox')); " 
                                                  value=""> 
                                       </td>
   <td style="padding-left: 4px"> 

                                   <select multiple size="8" style="width: 135px" runat="server" onBlur="selectAll(this, true, document.getElementById('<%=uilblDestinationQualOutlet.ClientID%>'))" id="outletToBox">
                                   </select> <span class="guide"></span>
                               </td></tr></table> 


                </div> 
            </asp:Panel>

Javascript:

function move(sourceFrom, sourceTo) {
            var arrFrom = new Array();
            var arrTo = new Array();
            var arrLU = new Array();
            var i;
            for (i = 0; i < sourceTo.options.length; i++) {
                arrLU[sourceTo.options[i].text] = sourceTo.options[i].value;
                arrTo[i] = sourceTo.options[i].text;
            }
            var fLength = 0;
            var tLength = arrTo.length;
            for (i = 0; i < sourceFrom.options.length; i++) {
                arrLU[sourceFrom.options[i].text] = sourceFrom.options[i].value;
                if (sourceFrom.options[i].selected && sourceFrom.options[i].value != "") {
                    arrTo[tLength] = sourceFrom.options[i].text;
                    tLength++;
                } else {
                    arrFrom[fLength] = sourceFrom.options[i].text;
                    fLength++;
                }
            }

            sourceFrom.length = 0;
            sourceTo.length = 0;

            var ii;
            for (ii = 0; ii < arrFrom.length; ii++) {
                var no = new Option();
                no.value = arrLU[arrFrom[ii]];
                no.text = arrFrom[ii];
                sourceFrom[ii] = no;
            }

            for (ii = 0; ii < arrTo.length; ii++) {
                var no = new Option();
                no.value = arrLU[arrTo[ii]];
                no.text = arrTo[ii];
                sourceTo[ii] = no;
            }

            (sourceTo).focus();

            if (sourceTo == (document.getElementById('outletFromBox'))) {
                (sourceFrom).focus();
            }
            if (sourceTo == (document.getElementById('QualMemTypeFromBox'))) {
                (sourceFrom).focus();
            }
            if (sourceTo == (document.getElementById('MemStatusFromBox'))) {
                (sourceFrom).focus();
            }
        }
  • 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-05-26T05:01:31+00:00Added an answer on May 26, 2026 at 5:01 am

    when you add runat=”server” to any control the client id of the control changes.
    I guess this is your problem, you should pass the client ids to the move function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function. This function is supposed to populate a html select-box
I have a javascript function below to move from select multiple box A which
I have a JavaScript function, pop_item . I have to call this from PHP,
I have a JQuery select component and a javascript function to handle the stop
This is my view page here i have a select box <tr> <td>Chidren</td> <td>:</td>
I have a select box object and an ajax function is called OnChange using
I have this bit of script to widen a text box on mouseover and
I have JavaScript Function in which I check for value of a stageId box
I have this form with a select list box in it. It shows a
I have a javascript function that manipulates the DOM when it is called (adds

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.