Problem in Select box ??

Hi All,
I have a select box like this
<select multiple="true" name="testList" size="5" class="fixedWidthInput">
</select>On the Screen i have a button "Add", Clicking on that button add one more row to the select box.I can add 36 rows there, but the moment i add 37th entry it gives me a JS error .
Any idea, why is this happening . Thanks

Hi..
Can you provide the Full link, i tryed to find out related problems but couldn't find the same scenario.
Thanks

Similar Messages

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • Select box problem

    I have a simple drop down box with the select item out of db
    like if the value in my db is i then the user will see two line of <option value="1">1</option>,
    is that a simple way to handle this problem?
    <select name="year">
                                            <option selected value="${found.year}"> <c:out value="${found.year}"/></option>
                                            <option  value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>
                                            <option value="6">6</option>
                                        </select>I don't want to use the method
    <c:if test="${found.year=='1'}">
    <option value="1" selected>1</option>
    <c:if test="${found.year!='1'}">
    <option value="1" >1</option>
    since if the select list is long , like to 100 then the code will turn to every long , should be have a better way , is that right??

    I try the follow, but the value out of my db never get select , what is wrong in the if condition??
    <%ArrayList<Integer> tyear = new ArrayList<Integer>();
                        for (int i = 1; i <= 10; i++) {
                            tyear.add(i);
    <select name="year">
                                            <% for (Integer num : tyear) {
                                                            String aY = Integer.toString(num);%>
                                            <c:if test="${found.year==aY}">
                                                <option selected value="${found.year}"> <c:out value="${found.year}"/></option>
                                            </c:if>
                                            <c:if test="${found.year!=aY}">
                                                <option value="<%= aY%>"><% out.println(aY);%></option>
                                            </c:if>
                                            <%}%>
                                        </select>Edited by: Hjava on Oct 26, 2011 11:27 PM
    The problem on this line , I don't get why is wrong!
    <c:if test="${found.year==aY}">

  • Problems with suggestions for selection boxes

    I first found this problem when typing in Google Maps selection box. If I type an A in the box, I am given several suggestions from my web history starting with A, but I can't find any way (single or double-click or drag) to make any of the suggestions go into the box. I tried Restart with Add-Ons Disabled but that doesn't help.

    I first found this problem when typing in Google Maps selection box. If I type an A in the box, I am given several suggestions from my web history starting with A, but I can't find any way (single or double-click or drag) to make any of the suggestions go into the box. I tried Restart with Add-Ons Disabled but that doesn't help.

  • Multi-Select Box Not Displaying Values Passed From Grid?

    Coldfusion 8
    I inherited an application and am trying to maintain and improve it... hit a snag today.
    I have a multi-select box that is not displaying what I expect.  The values come from a ColdFusion grid which is based off a database query.
    Here is the code for the select - does not work - nothing is selected:
    <cfselect name="USER_IDS" multiple="true" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    Now if I change the multiselect to a single select like below - it takes the first item in the field list (from the grid) and selects it in the drop down.
    <cfselect name="USER_IDS" multiple="false" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    Or if I assign a variable like this and use the multi-select code it seems to work as well.
    testlist = "22,26";
    <cfselect name="USER_IDS" multiple="true" queryposition="below" selected="#testlist#" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    I have displayed the value of "User_IDs" in the grid and in the data entry part of the screen to see values of:  22,26
    to make sure that wasn't my issue.
    Do grids and multiselects require something additional?  Any advice on how to resolve?

    Problem was related to some javascript for the select box.  There was a function for a single select box but not a multiple select box - this fixed it: 
    if(theForm.elements[i].type == "select-multiple"){
                        var selectBox = theForm.elements[i];
                        var sbname = selectBox.name;
                        cpvalue = String(eval('record.data.' + sbname));
                        var NotifyArray = cpvalue.split(',');
                        for (var j=0; j < selectBox.length; j++) {
                            selectBox[j].selected = false;
                        for (var j=0; j < selectBox.length; j++) {
                            sbvalue = selectBox[j].value;
                            for (var k=0; k < NotifyArray.length; k++){
                                if (sbvalue == NotifyArray[k]){
                                    selectBox[j].selected = true;

  • Multiple Select boxes in one form

    Does anyone know if it is possible to have multiple select
    boxes inside one form? I have six different select boxes that are
    generated by six separate queries. The action page for all six
    select boxes is the same so I just want one submit button so users
    don't get confuse. I don't want to cluster up the page with submit
    buttons but I may resort to that option.
    My problem is the select boxes generate a number and when
    that number is submitted I want to pass two other variables with it
    to the action page. I tried putting a "Form" tag around the 6
    select boxes. Inside each select box I tried to add an "Input
    type="hidden"" and give thte name and values that I needed. That
    worked for the first select box but when I tried the second select
    box it used the hidden values for the first select box.
    If anyone can help, I would greatly appreciate it. Or if you
    have any other suggestions I am open to any.
    Thanks

    Paross1,
    I wasn't thinking about that and you gave me a great idea.
    Here is how I changed my select boxes.
    <cfform
    action="Resolution_History.cfm?year=#year#&sessiontype=#sessiontype#&btype=res"
    name="form">
    <select name="SRINPUT">
    <option value="">SR
    <CFOUTPUT Query="findSR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="HRINPUT">
    <option value="">HR
    <CFOUTPUT Query="findHR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="SCRINPUT">
    <option value="">SCR
    <CFOUTPUT Query="findSCR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <br>
    <select name="HCRINPUT">
    <option value="">HCR
    <CFOUTPUT Query="findHCR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="SJRINPUT">
    <option value="">SJR
    <CFOUTPUT Query="findSJR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="HJRINPUT">
    <option value="">HJR
    <CFOUTPUT Query="findHJR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <INPUT TYPE="Submit" VALUE="Submit" alt="submit
    button">
    </cfform>
    On the action page I need the below IF statement to work so
    it will set the variables. It isn't working at this time. Its not
    bringing the values of billnumber, houseorig or the billtype.
    Do you have any thoughts? I know it is close. I need to set
    all of the inputs to input4 to generate my queries.
    <cfif form.srinput gt 0>
    <cfset houseorig eq "s">
    <cfset billtype eq "r">
    <cfset srinput eq input4>
    <cfelseif form.hrinput gt 0>
    <cfset houseorig eq "h">
    <cfset billtype eq "r">
    <cfset hrinput eq input4>
    <cfelseif form.scrinput gt 0>
    <cfset houseorig eq "sc">
    <cfset billtype eq "r">
    <cfset scrinput eq input4>
    <cfelseif form.hcrinput gt 0>
    <cfset houseorig eq "hc">
    <cfset billtype eq "r">
    <cfset hcrinput eq input4>
    <cfelseif form.sjrinput gt 0>
    <cfset houseorig eq "sj">
    <cfset billtype eq "r">
    <cfset sjrinput eq input4>
    <cfelse>
    <cfset houseorig eq "hj">
    <cfset billtype eq "r">
    <cfset hjrinput eq input4>
    </cfif>

  • Selection boxes in Barracuda Anti Spam and Virus Firewall do not appear in 7.0. They appeared in previous versions, and in IE.

    Selection boxes in Barracuda Anti Spam and Virus Firewall do not appear in 7.0. They appeared in previous versions, and in IE.

    FIXED!
    I reverted back to 3.6.23 and all works fine. From everything I can tell; number of problems submitted, breadth of issues, no access to versions 4, 5, 6 (rapid version turnover with no support), and now beta being released for 8, it seems FF is having the user base do all it's alpha/beta testing without consent. Being in product marketing myself, I probably would have lost a significant percentage of my customer base by now. When FF begins to support a new mainstream release, then I'll be interested again.

  • Select box choice resetting

    I have a drop-down box that I am using to control the sorting
    of my dataset. The drop-down box is located in a spry region
    because I want to display different sorting choices depending on a
    javascript variable. I have it scripted so that the dataset.sort()
    function is called by the drop-down box's onChange handler. It
    works great for the sorting - the only problem is that the
    drop-down box always reverts back to the first <option> as
    soon as the sort() method is called and I would prefer to have it
    remain on the last selected index. I know I could probably rig
    something complicated in JavaScript involving observer objects and
    dynamically building the select options, but before I went down
    that road, I was wondering if anyone knew how to get the
    <select> box from reverting first?
    I attached a quick sample of what I'm talking about below:
    <td spry:region="dsPlans" class="SpryHiddenRegion">
    <span spry:choose="spry:choose">
    <!--- When selected, this select box always resets to
    whatever the first option is --->
    <select name="sSortBy" spry:when="var1 == 'value1'"
    onChange="dsPlans.sort(this.value,'toggle');">
    <option value="Field1">Field1</option>
    <option value="Field2">Field2</option>
    <option value="Field3">Field3</option>
    </select>
    <select name="sSortBy" spry:when="var1 == 'value2'"
    onChange="dsPlans.sort(this.value,'toggle');">
    <option value="Field4">Field4</option>
    <option value="Field5">Field5</option>
    <option value="Field6">Field6</option>
    </select>
    <select name="sSortBy" spry:default="spry:default"
    onChange="dsPlans.sort(this.value,'toggle');">
    <option value="Field7">Field7</option>
    <option value="Field8">Field8</option>
    <option value="Field9">Field9</option>
    </select>
    </span>
    </td>
    Any help is greatly appreciated! Thanks!

    Hi Michael,
    The cleanest way is to use observers as you suggest.
    onPreUpdate, store the selected index of the select, and then
    onPostUpdate, restore it. Something like:
    var savedIndex = 0;
    dsPlans.addObserver(function(noticationType, notifier, data)
    if (notificationType == "onPreUpdate" &&
    document.forms[ 0 ] && document.forms[ 0 ].sSortBy)
    savedIndex = document.forms[0].sSortBy.selectedIndex;
    else if (notificationType == "onPostUpdate")
    document.forms[ 0 ].sSortBy.selectedIndex = savedIndex;
    You'd probably also want some logic that resets this
    savedIndex whenever your var1 changes too.
    --== Kin ==--

  • How to update database with a select box

    I'm hoping someone can/will help me with a new feature I'm
    trying to add to my web site. I'll summarize what I'm working with
    and then proceed to what I'd like to do. This is the web site I'm
    working on: www.truckerstoystore.net
    I have a database for the Truck of the Week set up with the
    information that is output on each page in the left column and
    on the Truck of the week page itself. I add new Truck of the
    Week (TOW) entries via a form I've put together. Right now, in
    order to change the current TOW, I have to manually go into my
    template and change the ID (which is automatically assigned when
    the record is created, and thus makes it unique) in my SQL which
    currently reads
    SELECT *
    FROM truckofweek
    WHERE ID="4"
    to the ID of the current TOW.
    What I want to be able to do is create a new form that will
    allow me to select the TOW entry that I want to be displayed from a
    select box (drop down box). I have a good idea of how to populate
    my select box, but don't know how to get it to work. My first idea
    was to update the table in the database (Access) manually with a
    new column called currentTOW, with values set to a Yes/No type,
    with default values set to "No". Then I would use my form to set
    the value for one of them to "Yes" so I could set my SQL to 'WHERE
    currentTOW ="yes" ' I would also make a <cfif> statement that
    checks for entries marked "Yes" and changes them to "No" when the
    form loads to avoid setting 2 entries to "Yes" and my page thus
    attempting to load 2 TOW entries.
    My problem is, I don't know how to do any of this. I hope
    I've described this situation well enough. I know there has to be
    at least one guru on here that can help me. Any assistance would be
    greatly appreciated.

    Hey,
    Thanks for replying. That sounds like a good idea, but I
    don't know how to do it.
    I started working on a new idea, where I have a second table
    in the same datasource set up called currentTOW, with one field
    called currentTOW and only one record. The idea is to send the
    string of the "owner" field from the select box, which is populated
    from the table called truckofweek to this one cell in the
    currentTOW table.
    This way, in my page which will display the data, I have 2
    querys. The first pulls the data in the single cell from currentTOW
    and outputs its string into the second query. I've attached the
    code below. I get an error when I try to display the page, see the
    error here:
    www.truckerstoystore.net/currentTOW2.cfm.
    However, the SQL looks like I want it to look, as "WHERE Owner =
    Craig Carp" is essentially the same record that it displays now in
    the live page "/currentTOW.cfm" only the SQL currently reads "WHERE
    ID = 4" (4 and Craig Carp are part of the same record).
    Here is the link to my form:
    Form

  • Selection box not working

    i was asked to edit some code
    one of the selection boxes wasnt working and was not updating
    the db at all
    here is the code snippet
    <!--- the CFC code being called
    this basically puts together the values which are valid for
    display in the selection box
    then returns it to the invoker
    --->
    <CFFunction name = "Sel_SpecifiedDateFlag" output =
    "false" returntype = "string" access = "public">
    <!--- 引数の定義 --->
    <CFArgument name = "prm_SelID" required = "true">
    <CFSet res1 = "">
    <!---
    コンボリストのID設定(一元管理)--->
    <cfset id = 8>
    <CFQuery name = "query1" datasource = "#APP_DB_DSN#">
    select code , COALESCE(code::text,'') || ':' ||
    COALESCE(name,'') as name
    from tblpmdsetcomblist
    where valid_flag = 1
    and id = #id#
    order by sort,code
    </CFQuery>
    <CFQuery name = "query2" datasource = "#APP_DB_DSN#">
    select code from tblpmdsetcomblist
    where valid_flag = 1
    and id = #id#
    and default_flag = 1
    </CFQuery>
    <!---
    念のため、デフォルト確認
    --->
    <CFIf query2.RecordCount NEQ 1>
    <CFReturn "<font
    color='red'><strong>リストテーブルデフォルトエラー</strong></font>">
    </CFIf>
    <!---
    prm_SelIDがNullの時のデフォルトを設定
    --->
    <CFIf prm_SelID eq "">
    <CFSet prm_SelID = #query2.code#>
    </CFIf>
    <CFLoop Query="query1">
    <CFSet res1 = res1 & "<OPTION Value='#code#'">
    <CFIf Compare(code , prm_SelID) eq 0>
    <CFSet res1 = res1 & " SELECTED">
    </CfIf>
    <CFSet res1 = res1 & ">">
    <CFSet res1 = res1 & #name#>
    <CFSet res1 = res1 & "</OPTION>#chr(10)#">
    </CFLoop>
    <CFReturn res1>
    </CfFunction>
    <!--- this is the code that invokes the CFC code above and
    displays it as well
    --->
    <CFInvoke Component="component.selbox"
    Method="Sel_Plusoneflag" ReturnVariable="getstr">
    <CFInvokeArgument name="prm_SelID"
    Value="#plus_one_flag#">
    </CFInvoke>
    <select name="plus_one_flag" Size=1>
    <CFOutput>#getstr#</CFOutput>
    </select>
    <!--- this is what #getstr# looks like when viewed via
    page source viewer
    --->
    <select name="plus_one_flag" Size=1>
    <OPTION Value='0'
    SELECTED>0:プラフワン不可</OPTION>
    <OPTION
    Value='1'>1:プワスワン可</OPTION>
    </select>
    i checked all the sources of the problem which are obvious to
    me but found none :(
    btw the ascii characters in the code are japanese characters
    if youre not seeing them properly

    in the code you posted there is no code for updating the
    db...
    plus:
    >
    > <CFQuery name = "query1" datasource =
    "#APP_DB_DSN#">
    > select code , COALESCE(code::text,'') || ':' ||
    COALESCE(name,'') as name
    > from tblpmdsetcomblist
    > where valid_flag = 1
    > and id = #id#
    > order by sort,code
    > </CFQuery>
    there is no 'sort' column pulled from the db or aliased by
    that name as
    it appears in the order by clause in the query above...
    > <!--- this is the code that invokes the CFC code
    above and displays it as well
    > --->
    >
    > <CFInvoke Component="component.selbox"
    Method="Sel_Plusoneflag"
    > ReturnVariable="getstr">
    you did not post any code for the 'Sel_Plusoneflag' function
    in your
    cfc... did you post a wrong function or should you change the
    method's
    name in the cfinvoke?
    >
    > i checked all the sources of the problem which are
    obvious to me but found
    > none :(
    and what's the actual problem you are facing? the select box
    still not
    working (HOW is it not working? - not displaying/displaying
    wrong data?)
    or something else?
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Laughing sound, media keys funny, and black select boxes

    I've only had my macbook for 2 weeks and its gone weird today. It starts with a black select box around icons, popup windows, and the task bar. Then i try to listen to the new mac holiday add when i hear weird laughing. Then the laughing starts when i click on something, anything. I try to turn down the volume with the media key (F12) then dashboard comes in. The contrast keys dont work, and F11 makes firefox browser move to the top right of the screen out of view.
    HELP ME i am in mac ****.

    Hi Doug,
    Thank you for your help. I have done some more problem solving and I found something strange in the activity monitor. So i 'quit the process' and shut down. Its all fixed now.
    Thanks again, Merry Christmas

  • Populate a select Box without reloading Page

    I have about three to four select boxes (dropdowns), that I
    want to populate the next select drop down based on user selection
    from the previous select dropdown and vise versa without having a
    page reload. This is an app we are migrating from flash to CF
    because of too much problem with flash.
    Please can you show examples of doing this

    eziokolo wrote:
    >
    > Is there a way I can get this done without reloading or
    refreshing the page? I
    > mean refresh data in the Select Drop down and textboxes?
    >
    > Thanks
    > E
    >
    Yes, but you must first answer yourself, "Where does the data
    come from."
    From a user interface point of view you simply use
    JavaScript to access
    the various form control DOM elements and change their values
    on the
    desired events.
    But you have to know where the data can come from. To do it
    without a
    refresh, the client has to already have to data. If there is
    too much
    data do deliver all at once to the client, then you can *not*
    do it
    without some type of request to the server.
    But you can make such a request without refreshing the user
    interface by
    accessing it with other technologies such as asynchronous
    JavaScript and
    XML, popularly known as AJAX.
    Or you could go to a more advanced client interface then the
    HTTP
    browser. Adobes preferred tool is Flex, but that gets you
    back to
    Flash, and I do not know why you are trying to get away from
    Flash so
    that may not be that appealing to you.

  • A way to temporarily hide the selection box around an object while nudging it.

    InDesign
    I would like to see a simple "Hide All" type command, similar to the "Hide Extras" feature in Photoshop - this would leave the page in a blank/ "preview" like view, but with selected objects still selected and therefore able to be moved around without seeing the Blue Selection Box.
    PROBLEM:
    I am looking for a way to temporarily hide the selection box around an object while nudging it.
    I want to visually nudge items around to find the ideal placement and I find the selection box distracting how it follows the object around as it is being nudged.
    (For anyone familiar with Photoshop, —I am looking for something that works exactly like "Hide" cmd+H  (VIEW > Extras) does in PS - where the selection goes away but the object is still adjustable.

    Thanks, but I don't see how that's helpful really.
    SHIFT+W goes into full on presentation mode already.
    Also, —this still doesn't solve the problem of being able to move an element around without a selection box getting in the way.
    I don't believe that a solution exists, I'm just checking with the community if one does.

  • DYNAMIC SELECT BOX

    The problem is that the second select box is not displaying what is the wrong in the code
    <html>
    <head>
    <script>
    function setList(theList) {
    switch (theList) {
    case 1 : {
    document.theForm.mySelect.options[0].value="50THD-OZAM";
    document.theForm.mySelect.options[1].value="ABABA-BALB";
    document.theForm.mySelect.options[2].value="BALAB-KIDA";
    document.theForm.mySelect.options[3].value="CALIC-BABA";
    document.theForm.mySelect.options[4].value="GUTAO-DINE";
    document.theForm.mySelect.options[5].value="";
    document.theForm.mySelect.options[6].value="";
    document.theForm.mySelect.options[7].value="";
    document.theForm.mySelect.options[0].selected=true;
    document.theForm.radioButton[0].checked=true;
    break;
    case 2 : {
    document.theForm.mySelect.options[0].value="AGON";
    document.theForm.mySelect.options[1].value="AJUY";
    document.theForm.mySelect.options[2].value="Abay";
    document.theForm.radioButton[1].checked=true;
    break;
    case 3 : {
    document.theForm.mySelect.options[0].value="KAL";
    document.theForm.mySelect.options[1].value="ILO ";
    document.theForm.mySelect.options[2].value="LEY";
    document.theForm.radioButton[2].checked=true;
    break;
    setOptionText();
    function setOptionText() {
    document.theForm.mySelect.options[0].text=document.theForm.mySelect.options[0].value;
    document.theForm.mySelect.options[1].text=document.theForm.mySelect.options[1].value;
    document.theForm.mySelect.options[2].text=document.theForm.mySelect.options[2].value;
    var group=new Array(document.theForm.mySelect.options.length)
    for (i=0; i<document.theForm.mySelect.options.length; i++)
    group=new Array()
    group[0][0]=new Option("---Select2---"," ");
    group[1][0]=new Option("Now Select This One"," ");
    group[1][1]=new Option("C","3");
    group[1][2]=new Option("DA","2");
    group[1][3]=new Option("DB","1");
    group[2][0]=new Option("Now Select This One"," ");
    group[2][1]=new Option("A","5");
    function redirect(x)
    var i=document.theForm.mySelect.options.length
    for (m=0;m<i;m++)
    for (i=0;i<group[x].length;i++)
    document.theForm.stage2.options[i]=new Option(group[x][i].text,group[x][i].value)
    </script>
    </head>
    <body onload="setList(1)">
    <form name="theForm" onreset="setList(1)">
    BirthPlace is:<br>
    <input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
    <input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
    <input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
    <select name="mySelect" onChange="redirect(this.options.selectedIndex)">
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    </select>
    <select name="stage2" size="1" >
    <option value=" " > </option>
    <option value=" " ></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    </select>
    <br><br>
    </form>
    </body>
    </html>

    hello mate,
    you can just use another javascript code for your application since it seems that( as well as i understood ) you couldn't set the array if user make a selection.
    A few times ago i had a probelm like that but i used the below code..
    Here the DynamicOptionList.js file and source code:
    you just call this code from your html page like this :
    <SCRIPT LANGUAGE="JavaScript" SRC="DynamicOptionList.js"></SCRIPT>
    //STARTS HERE DynamicOptionList.js
    // CONSTRUCTOR
    // Pass in the name of the element, then the names of the lists it depends on
    function DynamicOptionList() {
         if (arguments.length < 2) { alert("Not enough arguments in DynamicOptionList()"); }
         // Name of the list containing dynamic values
         this.target = arguments[0];
         // Set the lists that this dynamic list depends on
         this.dependencies = new Array();
         for (var i=1; i<arguments.length; i++) {
              this.dependencies[this.dependencies.length] = arguments;
         // The form this list belongs to
         this.form = null;
         // Place-holder for currently-selected values of dependent select lists
         this.dependentValues = new Object();
         // Hold default values to be selected for conditions
         this.defaultValues = new Object();
         // Storage for the dynamic values
         this.options = new Object();
         // Delimiter between dependent values
         this.delimiter = "|";
         // Logest string currently a potential options (for Netscape)
         this.longestString = "";
         // The total number of options that might be displayed, to build dummy options (for Netscape)
         this.numberOfOptions = 0;
         // Method mappings
         this.addOptions      = DynamicOptionList_addOptions;
         this.populate           = DynamicOptionList_populate;
         this.setDelimiter     = DynamicOptionList_setDelimiter;
         this.setDefaultOption      = DynamicOptionList_setDefaultOption;
         this.printOptions      = DynamicOptionList_printOptions;
         this.init           = DynamicOptionList_init;
    // Set the delimiter to something other than | when defining condition values
    function DynamicOptionList_setDelimiter(val) {
         this.delimiter = val;
    // Set the default option to be selected when the list is painted
    function DynamicOptionList_setDefaultOption(condition, val) {
         if (typeof this.defaultValues[condition] == "undefined" || this.defaultValues[condition]==null) {
              this.defaultValues[condition] = new Object();
         for (var i=1; i<arguments.length; i++) {
              this.defaultValues[condition][arguments[i]]=1;
    // Init call to map the form to the object and populate it
    function DynamicOptionList_init(theform) {
         this.form = theform;
         this.populate();
    // Add options to the list.
    // Pass the condition string, then the list of text/value pairs that populate the list     
    function DynamicOptionList_addOptions(dependentValue) {
         if (typeof this.options[dependentValue] != "object") { this.options[dependentValue] = new Array(); }
         for (var i=1; i<arguments.length; i+=2) {
              // Keep track of the longest potential string, to draw the option list
              if (arguments[i].length > this.longestString.length) {
                   this.longestString = arguments[i];
              this.numberOfOptions++;
              this.options[dependentValue][this.options[dependentValue].length] = arguments[i];
              this.options[dependentValue][this.options[dependentValue].length] = arguments[i+1];
    // Print dummy options so Netscape behaves nicely
    function DynamicOptionList_printOptions() {
         // Only need to write out "dummy" options for Netscape
    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) <= 4)){
              var ret = "";
              for (var i=0; i<this.numberOfOptions; i++) {
                   ret += "<OPTION>";
              ret += "<OPTION>"
              for (var i=0; i<this.longestString.length; i++) {
                   ret += "_";
              document.writeln(ret);
    // Populate the list
    function DynamicOptionList_populate() {
         var theform = this.form;
         var i,j,obj,obj2;
         // Get the current value(s) of all select lists this list depends on
         this.dependentValues = new Object;
         var dependentValuesInitialized = false;
         for (i=0; i<this.dependencies.length;i++) {
              var sel = theform[this.dependencies[i]];
              var selName = sel.name;
              // If this is the first dependent list, just fill in the dependentValues
              if (!dependentValuesInitialized) {
                   dependentValuesInitialized = true;
                   for (j=0; j<sel.options.length; j++) {
                        if (sel.options[j].selected) {
                             this.dependentValues[sel.options[j].value] = true;
              // Otherwise, add new options for every existing option
              else {
                   var tmpList = new Object();
                   var newList = new Object();
                   for (j=0; j<sel.options.length; j++) {
                        if (sel.options[j].selected) {
                             tmpList[sel.options[j].value] = true;
                   for (obj in this.dependentValues) {
                        for (obj2 in tmpList) {
                             newList[obj + this.delimiter + obj2] = true;
                   this.dependentValues = newList;
         var targetSel = theform[this.target];
         // Store the currently-selected values of the target list to maintain them (in case of multiple select lists)
         var targetSelected = new Object();
         for (i=0; i<targetSel.options.length; i++) {
              if (targetSel.options[i].selected) {
                   targetSelected[targetSel.options[i].value] = true;
         targetSel.options.length = 0; // Clear all target options
         for (i in this.dependentValues) {
              if (typeof this.options[i] == "object") {
                   var o = this.options[i];
                   for (j=0; j<o.length; j+=2) {
                        var text = o[j];
                        var val = o[j+1];
                        targetSel.options[targetSel.options.length] = new Option(text, val, false, false);
                        if (typeof this.defaultValues[i] != "undefined" && this.defaultValues[i]!=null) {
                             for (def in this.defaultValues[i]) {
                                  if (def == val) {
                                       targetSelected[val] = true;
         targetSel.selectedIndex=-1;
         // Select the options that were selected before
         for (i=0; i<targetSel.options.length; i++) {
              if (targetSelected[targetSel.options[i].value] != null && targetSelected[targetSel.options[i].value]==true) {
                   targetSel.options[i].selected = true;
    //********** ENDS HERE
    now the html page and how the trick is going :
    <HTML>
    <HEAD>
    <META CONTENT="text/html; charset=windows-1254" HTTP-EQUIV="Content-Type">
    <META CONTENT="text/html; charset=iso-8859-9" HTTP-EQUIV="Content-Type">
         <TITLE>JavaScript Toolbox - Dynamic Option List</TITLE>
    <SCRIPT LANGUAGE="JavaScript" SRC="C:\WINNT\Profiles\calisirmu\Desktop\javaScripts\DynamicOptionList.js"></SCRIPT>
    <SCRIPT LANGUAGE="JavaScript">
    // First example
    var listB = new DynamicOptionList("B","A");
    //first initialize parameters
    listB.addOptions("CARs",
              "BMW","BMW",
              "PEUGEOT","PEUGEOT",
              "PORSCHE","PORSCHE",
              "TOYOTA","TOYOTA");     
    listB.addOptions("MOTORCYCLEs",
              "HONDA","HONDA",
              "KAWASAKI","KAWASAKI");
    listB.addOptions("FORMULA CARS",
              "FERRARI","FERRARI",
              "MERCEDES","MERCEDES",
              "JAGUAR","JAGUAR");
    //set default options
    listB.setDefaultOption("CARs","PORSCHE");
    listB.setDefaultOption("MOTORCYCLEs","HONDA");
    listB.setDefaultOption("FORMULA CARS","FERRARI");
    var listC = new DynamicOptionList("C","A","B");
    listC.addOptions("CARs|PORSCHE","911 TURBO GT2","911 TURBO GT2",
                        "MOBY DICK","MOBY DICK",
                        "GT1 RACE VERSION","GT1 RACE VERSION");
    listC.setDefaultOption("CARs|PORSCHE","911 TURBO GT2");
    listC.addOptions("CARs|BMV","750 IL","750 IL");
    listC.addOptions("CARs|PEUGEOT","406","406");
    listC.addOptions("CARs|TOYOTA","AVENSIS","AVENSIS");
    listC.addOptions("MOTORCYCLEs|HONDA","SUPER 5000","SUPER 5000");
    listC.setDefaultOption("MOTORCYCLEs|HONDA","SUPER 5000");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","SUPER KACAR","SUPER KACAR");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","YAVAS GIDER","YAVAS GIDER");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","ANCA GIDER","ANCA GIDER");
    listC.addOptions("FORMULA CARS|FERRARI","F1 2000","F1 2000");
    listC.setDefaultOption("FORMULA CARS|FERRARI","F1 2000");
    listC.addOptions("FORMULA CARS|MERCEDES","CLK","CLK");
    listC.addOptions("FORMULA CARS|JAGUAR","SALLA GITSIN","SALLA GITSIN");
    function init() {
         var theform = document.forms[0];
         listB.init(theform);
         listC.init(theform);
         listE.init(theform);
         listF.init(theform);
    </SCRIPT>
    </HEAD>
    <BODY BGCOLOR=#FFFFFF LINK="#00615F" VLINK="#00615F" ALINK="#00615F" onLoad="init()">
    <BR><BR>
    <BR>
    <FORM ACTION="" METHOD="" name="Form1">
    <BR>
    <TABLE BORDER="0">
    <TR bgcolor="#ffffe6">
         <TH >TYPE</TH>
         <TH>NAME</TH>
         <TH>MODEL</TH>
    </TR>
    <TR>
         <TD>
              <SELECT NAME="A" onChange="listB.populate();listC.populate();">
                   <OPTION VALUE="CARs">CARs
                   <OPTION VALUE="MOTORCYCLEs">MOTORCYCLEs
                   <OPTION VALUE="FORMULA CARS">FORMULA CARS
              </SELECT>
         </TD>
         <TD>
              <SELECT NAME="B" onChange="listC.populate();">
                   <SCRIPT LANGUAGE="JavaScript">listB.printOptions()</SCRIPT>
              </SELECT>
         </TD>
         <TD>
              <SELECT NAME="C">
                   <SCRIPT LANGUAGE="JavaScript">listC.printOptions()</SCRIPT>
              </SELECT>
         </TD>
    </TR>
    </TABLE>
    </FORM>
    </BODY>
    </HTML>
    you save this html page as xxx.html and thane run it.
    I hope this is beneficial for you.
    mcaldeveloper :-)

  • Pre-selecting from Spry Data Select Box

    Hi
    I am new here so sorry if this is in the wrong section/format
    I am using Two Spry XML Datasets to populate 2 dropdown boxes with  vehicle makes and the connected model names (there are other fields but for the sake of clarity I will only show these 2). The XML is dynamically generated by PHP/MySQL and works great for initially creating records. The problem I have is when I want to edit my record and so pre-select the data in the dropdown select box. The first box is easy and works fine but the second box only updates when the first is updated using the 'onchange' and I cannot get it to update on load. I can get it to update 'onclick' or other events but I need it to  update the second box when the page loads. Any ideas? I am sure there is a simple solution staring me in the face, but I just can't see it
    My code is listed below. I have cut out all the unnecessary code to make it more clear (hopefully)
    <script src="../../SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="../../SpryAssets/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    var dsmakes = new Spry.Data.XMLDataSet("xmlgenmake.php", "vehicle/makes");
    var dsmodel = new Spry.Data.XMLDataSet("xmlgenmodel.php?xmlmake={dsmakes::make}", "makes/models/model");
    </script>
    </head>
    <body>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
    <span spry:region="dsmakes" id="makeSelector">
      <select spry:repeatchildren="dsmakes" id="makeSelect" name="make" onchange="document.forms[0].modelSelect.disabled = true; dsmakes.setCurrentRowNumber(this.selectedIndex);">
        <option spry:if="'{dsmakes::make}' == '<?php echo $row_Recordset1['make']; ?>'" value="{dsmakes::make}" selected="selected">{dsmakes::make}</option>
        <option spry:if="'{dsmakes::make}' != '<?php echo $row_Recordset1['make']; ?>'" value="{dsmakes::make}">{dsmakes::make}</option>
      </select>
    </span><span spry:region="dsmodel" id="modelSelector">
    <select spry:repeatchildren="dsmodel" id="modelSelect" name="model">
      <option spry:if="'{dsmodel::model}' == '<?php echo $row_Recordset1['model']; ?>'" value="{dsmodel::model}" selected="selected">{dsmodel::model}</option>
      <option spry:if="'{dsmodel::model}' != '<?php echo $row_Recordset1['model']; ?>'" value="{dsmodel::model}">{dsmodel::model}</option>
    </select>
    </span>
    </body>
    </html>

    Sorry for not being clear -
    The first Spry Select box populates with the Vehicle Makes and selects the stored make from the DB. The second box is supposed to populate with the corresponding Vehicle Models (corresponding to the Vehicle Make in box one) but it initially only populates with the first makes data (not the selected one) if I add:    onfocus="dsmakes.setCurrentRowNumber(this.selectedIndex);     to the first box it works as it should as soon as it receives focus and the second box updates and selects the correct model.
    I have tried adding
    Spry.Utils.addLoadListener(InitPage);
         function InitPage() {
           dsmakes.setCurrentRowNumber(makeSelect.selectedIndex);
    but I cannot get the second box to update without clicking on the first
    It seems there should be s simple solution to this but I cannot see it.

Maybe you are looking for