dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Dynamically Load a Drop Down List Box

  1. #1
    Larry Hunter Guest

    Dynamically Load a Drop Down List Box




    Hi -

    One Other question. How is it possible to dynamically load a drop down selection
    list box with data while the page is loaded on the client's machine?

    Many thanks

    Larry



  2. #2
    Glenn Guest

    Re: Dynamically Load a Drop Down List Box


    Try this. Don't worry about the fact that I'm processing a recordset; this
    IS client-side code (I'm using RDS to get a recordset to the client dynamically).
    The source of the data that you use to load your combo/list box is whatever
    you need.

    Sub LoadStates()

    Dim rsStates
    Dim fldStAbbr
    Dim fldStName
    Dim objOptionElement
    Dim nX

    Set rsStates = gobjNCSCAT.GetRecordSet "ndstate"
    Set fldStAbbr = rsStates.fields.item("stabbr")
    Set fldStName = rsStates.fields.item("stname")

    nX = 0

    While Not rsStates.EOF
    Set objOptionElement = window.document.createElement("OPTION")
    objOptionElement.value = fldStAbbr.value
    objOptionElement.text = fldStAbbr.value & " - " & fldStName.value
    window.frmContactMaint.cboStCdContact.add objOptionElement

    rsStates.MoveNext
    nX = nX + 1
    Set objOptionElement = Nothing
    Wend

    Set rsStates = Nothing
    Set fldStAbbr = Nothing
    Set fldStName = Nothing

    End Sub



    "Larry Hunter" <Hunterlmc@gateway.net> wrote:
    >
    >
    >
    >Hi -
    >
    >One Other question. How is it possible to dynamically load a drop down

    selection
    >list box with data while the page is loaded on the client's machine?
    >
    >Many thanks
    >
    >Larry
    >
    >



  3. #3
    Larry Hunter Guest

    Re: Dynamically Load a Drop Down List Box



    Another developer suggested that I use the IFRAME tag to reference another
    page. This approach has the benefit of allowing me to query the database
    for the values that I require. However, this approach also leaves the question
    of how I pass selected values back from the frame.

    Larry



    "Glenn" <gaclark@broughton-sys.com> wrote:
    >
    >Try this. Don't worry about the fact that I'm processing a recordset; this
    >IS client-side code (I'm using RDS to get a recordset to the client dynamically).
    > The source of the data that you use to load your combo/list box is whatever
    >you need.
    >
    >Sub LoadStates()
    >
    > Dim rsStates
    > Dim fldStAbbr
    > Dim fldStName
    > Dim objOptionElement
    > Dim nX
    >
    > Set rsStates = gobjNCSCAT.GetRecordSet "ndstate"
    > Set fldStAbbr = rsStates.fields.item("stabbr")
    > Set fldStName = rsStates.fields.item("stname")
    >
    > nX = 0
    >
    > While Not rsStates.EOF
    > Set objOptionElement = window.document.createElement("OPTION")
    > objOptionElement.value = fldStAbbr.value
    > objOptionElement.text = fldStAbbr.value & " - " & fldStName.value
    > window.frmContactMaint.cboStCdContact.add objOptionElement
    >
    > rsStates.MoveNext
    > nX = nX + 1
    > Set objOptionElement = Nothing
    > Wend
    >
    > Set rsStates = Nothing
    > Set fldStAbbr = Nothing
    > Set fldStName = Nothing
    >
    >End Sub
    >
    >
    >
    >"Larry Hunter" <Hunterlmc@gateway.net> wrote:
    >>
    >>
    >>
    >>Hi -
    >>
    >>One Other question. How is it possible to dynamically load a drop down

    >selection
    >>list box with data while the page is loaded on the client's machine?
    >>
    >>Many thanks
    >>
    >>Larry
    >>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center