Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Need help with Listboxes/arrays

Need help with Listboxes/arrays

Scheduled Pinned Locked Moved Web Development
data-structureshelpquestion
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PaigeFrank
    wrote on last edited by
    #1

    I am trying to write a web page that allows a user to select things from box1 (hospitallist1) which then show up in box2(selHospitals) - this works. Box2 items then need to be passed to the next page - I know I am just being braindead but I have been trying things for 3 hours - I cannot get this to pass the values to the next page. When I move items to the new listbox - does this create the array or do I need to do something else to create the string?. Any help is appreciated - I am new to .asp! Below is the code for both programs. Prog1: <%@ Language=VBScript %> <!-- document_onmouseover() //--> <!-- document_onmouseout() //--> <!-- function document_onmouseout() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Out";} } function document_onmouseover() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Over";} } //--> function addtocombo() { var i = 0 var selectedItem var selectedText var selectedValue var newoption1 for (counter = 0; counter < userslist.hospitallist.length; counter++) {if (userslist.hospitallist.options(counter).selected == 1) {selectedItem = document.userslist.hospitallist.selectedIndex; selectedText = document.userslist.hospitallist.options[counter].text; selectedValue = document.userslist.hospitallist.options[counter].value; newoption1 = new Option(selectedText, selectedValue, false, false); document.userslist.selitems.options[i] = newoption1; i = i + 1} } } function moveit() { var boxLength = document.userslist.selHospitals.length; var selectedItem = document.userslist.hospitallist1.selectedIndex; var selectedText = document.userslist.hospitallist1.options[selectedItem].text; var selectedValue = document.userslist.hospitallist1.options[selectedItem].value; var i; var isNew = true; if (boxLength != 0) { for (i = 0; i < boxLength; </x-turndown>

    A S 2 Replies Last reply
    0
    • P PaigeFrank

      I am trying to write a web page that allows a user to select things from box1 (hospitallist1) which then show up in box2(selHospitals) - this works. Box2 items then need to be passed to the next page - I know I am just being braindead but I have been trying things for 3 hours - I cannot get this to pass the values to the next page. When I move items to the new listbox - does this create the array or do I need to do something else to create the string?. Any help is appreciated - I am new to .asp! Below is the code for both programs. Prog1: <%@ Language=VBScript %> <!-- document_onmouseover() //--> <!-- document_onmouseout() //--> <!-- function document_onmouseout() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Out";} } function document_onmouseover() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Over";} } //--> function addtocombo() { var i = 0 var selectedItem var selectedText var selectedValue var newoption1 for (counter = 0; counter < userslist.hospitallist.length; counter++) {if (userslist.hospitallist.options(counter).selected == 1) {selectedItem = document.userslist.hospitallist.selectedIndex; selectedText = document.userslist.hospitallist.options[counter].text; selectedValue = document.userslist.hospitallist.options[counter].value; newoption1 = new Option(selectedText, selectedValue, false, false); document.userslist.selitems.options[i] = newoption1; i = i + 1} } } function moveit() { var boxLength = document.userslist.selHospitals.length; var selectedItem = document.userslist.hospitallist1.selectedIndex; var selectedText = document.userslist.hospitallist1.options[selectedItem].text; var selectedValue = document.userslist.hospitallist1.options[selectedItem].value; var i; var isNew = true; if (boxLength != 0) { for (i = 0; i < boxLength; </x-turndown>

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      I don't see wht a dynamically created OPTION list wouldn't get passed onto a called script... Why not try it and see what happens? It's frustrating being a genius and living the life of a moron!!!

      1 Reply Last reply
      0
      • P PaigeFrank

        I am trying to write a web page that allows a user to select things from box1 (hospitallist1) which then show up in box2(selHospitals) - this works. Box2 items then need to be passed to the next page - I know I am just being braindead but I have been trying things for 3 hours - I cannot get this to pass the values to the next page. When I move items to the new listbox - does this create the array or do I need to do something else to create the string?. Any help is appreciated - I am new to .asp! Below is the code for both programs. Prog1: <%@ Language=VBScript %> <!-- document_onmouseover() //--> <!-- document_onmouseout() //--> <!-- function document_onmouseout() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Out";} } function document_onmouseover() {if (top.event.srcElement.tagName == "BUTTON") {top.event.srcElement.className = "Over";} } //--> function addtocombo() { var i = 0 var selectedItem var selectedText var selectedValue var newoption1 for (counter = 0; counter < userslist.hospitallist.length; counter++) {if (userslist.hospitallist.options(counter).selected == 1) {selectedItem = document.userslist.hospitallist.selectedIndex; selectedText = document.userslist.hospitallist.options[counter].text; selectedValue = document.userslist.hospitallist.options[counter].value; newoption1 = new Option(selectedText, selectedValue, false, false); document.userslist.selitems.options[i] = newoption1; i = i + 1} } } function moveit() { var boxLength = document.userslist.selHospitals.length; var selectedItem = document.userslist.hospitallist1.selectedIndex; var selectedText = document.userslist.hospitallist1.options[selectedItem].text; var selectedValue = document.userslist.hospitallist1.options[selectedItem].value; var i; var isNew = true; if (boxLength != 0) { for (i = 0; i < boxLength; </x-turndown>

        S Offline
        S Offline
        satya chhikara
        wrote on last edited by
        #3

        Hi , The values from the page automatically delete when page load is executed . You have two options One , set the page Eventwireup ="false" in the html code . Then the control after pressing the button will not goes to page load . the second option is take an hidden variable in html and assigned the values of list box when you are assigning the values to another list box . and take the value from hidden variable and insert , between the values because the array of javascript is not supported by not net . when you need individual vaues use split function in .net . when you are retrving the values from the hidden variable use id of hidden variable .value

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups