Results 1 to 5 of 5

Thread: COmbo Box Problemo

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    COmbo Box Problemo

    I have a combobox on an insert form which contains a list of staff members and their ID's.

    e.g
    Paul : 1
    Anna: 2
    Jules: 3

    This all works fine until the user goes to the Update page. The update page contains the same combobox with the same list of staff members. The problem I am having is that if the user chooses "Anna" from the combo on the insert page.........on the update page "Paul" is always displayed because "Paul" is the first entry in the combo.

    How can I get the update page to display the member of staff in the combobox relating to the contents of the underlying field which in the case of "Anna" will be "2" ?

    Thanks in Advance

    Parksie

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You have to transfer the selected item through a session variable from the Insert page to the Update page and reselect it.

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    How do I reselect it in code?

    Parksie

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I haven't tested this but I think its close:
    VB Code:
    1. ComboBox1.SelectedItem = ComboBox1.Items.Item(ComboBox1.Items.IndexOf(Value))

    Or you could just pass the index and use this:
    VB Code:
    1. ComboBox1.SelectedItem = ComboBox1.Items.Item(Session("PassedIndex"))

  5. #5

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    I used to do this sort of thing in Classic ASP all the time :

    <select name="txtEmployment1" class="homesmall" id="txtEmployment1" tabindex="16">
    <option value="<%=(Recordset1.Fields.Item("App1EmploymentType").Value)%>"><%=(Recordset1.Fields.Item("App1Em ploymentType").Value)%></option>
    <option value="Full Time">Full Time</option>
    <option value="Part Time">Part Time</option>
    <option value="Self Employed">Self Employed</option>
    <option value="Not Working">Not Working</option>
    <option value="Unemployed">Unemployed</option>
    <option value="Retired">Retired</option>
    </select>

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width