Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp vb interacting with sql

Options
  • 21-01-2005 5:36pm
    #1
    Closed Accounts Posts: 293 ✭✭


    I am working on a system that requires a user to log in and edit employee data such as rosters.

    The list of employees is down the side and the days across the top.
    The user selects a work code from a dropdown box and when happy updates the form. The problem is that i am using a repeating region in dreamweaver to facilitate this. but how do i know from the updated results which dropdown is which (their is 200 employees, and seven days each table having a dropdown!!) the first line of dropdown lists all have their own names (mon,tues....) but using a repeating region means that its repeated.

    Thier is a dynamic list of employees so i cant set exactly with out repeating regions!

    please help yall


Comments

  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I don't really know anything about dreamweaver or repeating regions. From you post it sounds like it's giving you a seperate set of work code dropdowns for each employee you can select on the left. It's probably simpler to dynamically populate a dropdown with the employees and have that as part of your form with the single set of dropdowns for each days work code. You can then get which employee was selected using request/request.form like the rest of your dropdowns. Setting its size > 1 will make it into a selection list as opposed to a drop down.

    To dynamically create the employee dropdown first load your employee table into a recordset (rsEmployee) and then have something like
    response.write "<select name=""employee"" size=""200"">"
    rsEmployee.movefirst
    do while not rsEmployee.eof
       if rsEmployee("name") = request("employee") then
          response.write "<option selected>"& rsEmployee("name") & "</option>"
       else
          response.write "<option>"& rsEmployee("name") & "</option>"
       end if
    loop
    response.write "</select>"
    


  • Registered Users Posts: 706 ✭✭✭DJB


    Ok, I think I know what you are trying to do! Can get complicated so I hope you can hand code. I don't think you will be able to use dreamweaver built in functions to do the update part!

    To individually identify each dropdown, you need to do the following. If I understand correctly, you have a table that resembles layout below:

    Employee | Monday | Tuesday | Wednesday | Thursday | etc.
    Joe Bloggs | DropDownBox | DropDownBox | DropDownBox | DropDownBox | etc.
    Jane Bloggs | DropDownBox | DropDownBox | DropDownBox | DropDownBox | etc.

    That make sense? Hope so! Ok, In dreamweaver, your code should look something like this:

    Employee | Monday | Tuesday | Wednesday | Thursday | etc.
    <% = rsUser("US_NAME") %> | DropDownBox | DropDownBox | DropDownBox | DropDownBox | etc.

    Second line above, has a repeat region on it. For the name of the dropdown box, use the following code:

    <select name="Monday<% = rsUser("US_ID") %>" id="Monday<% = rsUser("US_ID") %>" ">

    This is to go into the repeat region row in the cell under monday. Repeat for Tuedays, Wed, etc.

    <select name="Tuesday<% = rsUser("US_ID") %>" id="Tuesday<% = rsUser("US_ID") %>" ">

    NOTE: rsUser above is the name of your recordset, US_ID is the name of your ID field in the database!

    Now, when the repeat region lays out, if you view source, it should have something like this below. I've only put the name of the dropdown box into the cell for demonstration...

    Employee | Monday | Tuesday | Wednesday | Thursday | etc.
    Joe Bloggs | Monday8 | Tuesday8 | Wednesday8 | Thursday8 | etc.
    Jane Bloggs | Monday13 | Tuesday13 | Wednesday13 | Thursday13 | etc.

    Bascially, what you've done is given each dropdown box the same name prefix for each column but changed the suffix of the name for each row. What results is that no dropdown menu will have the same name. :) You can call any one of them individually or you can cycle through them and do multiple updates in one go.

    I hope that helps and wasn't too confusing!!! :)

    Dave


Advertisement