drop down populate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phillip Parr

    drop down populate

    Hello, I have this script which should populate a drop down box depending on
    another drop box. The error is somewhere in this code here, but I can't find
    it. Any help would be greatly appreciated!



    <script language="javas cript">

    function subcat(category ,subcategory,de scription)
    {
    this.category=c ategory;
    this.subcategor y=subcategory;
    this.descriptio n=description;
    }

    function Populate(fldval ,frmobj)
    {
    if(fldval!="")
    {
    frmobj.drop2.le ngth=0;
    frmobj.drop2.op tions[0]=new Option("Subcate gory","");
    count=1;
    if(quantity[fldval]>0)
    {
    for(a=0;a<quant ity;a++)
    {
    if(subcategory[a].category==fldv al)
    {
    frmobj.drop2.op tions[count]=new
    Option(subcateg ory[a].subcategory,su bcategory[a].description);
    count++;
    }
    }
    }
    }
    }

    subcategory[0] = new subcat(1,1,"Des ktops");
    subcategory[1] = new subcat(4,2,"RAM ");
    quantity=2;

    </script>


  • Phillip Parr

    #2
    Re: drop down populate

    Ok, fixed it. I'm so silly!

    "Phillip Parr" <nomail@here.co m> wrote in message
    news:OdbWb.658$ Rb.442@news-binary.blueyond er.co.uk...[color=blue]
    > Hello, I have this script which should populate a drop down box depending[/color]
    on[color=blue]
    > another drop box. The error is somewhere in this code here, but I can't[/color]
    find[color=blue]
    > it. Any help would be greatly appreciated!
    >
    >
    >
    > <script language="javas cript">
    >
    > function subcat(category ,subcategory,de scription)
    > {
    > this.category=c ategory;
    > this.subcategor y=subcategory;
    > this.descriptio n=description;
    > }
    >
    > function Populate(fldval ,frmobj)
    > {
    > if(fldval!="")
    > {
    > frmobj.drop2.le ngth=0;
    > frmobj.drop2.op tions[0]=new Option("Subcate gory","");
    > count=1;
    > if(quantity[fldval]>0)
    > {
    > for(a=0;a<quant ity;a++)
    > {
    > if(subcategory[a].category==fldv al)
    > {
    > frmobj.drop2.op tions[count]=new
    > Option(subcateg ory[a].subcategory,su bcategory[a].description);
    > count++;
    > }
    > }
    > }
    > }
    > }
    >
    > subcategory[0] = new subcat(1,1,"Des ktops");
    > subcategory[1] = new subcat(4,2,"RAM ");
    > quantity=2;
    >
    > </script>
    >
    >[/color]


    Comment

    • Bas Cost Budde

      #3
      Re: drop down populate

      Phillip Parr wrote:
      [color=blue]
      > Ok, fixed it. I'm so silly![/color]

      No; otherwise you wouldn't have fixed it. ;-)

      Asking the question is the really helpful part.
      --
      Bas Cost Budde

      but the domain is nl

      Comment

      Working...