Results 1 to 7 of 7

Thread: Update Form with Combo Box Values

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182

    Update Form with Combo Box Values

    I have a form that I use for both editing and adding. When the form is used for editing I load the fields with vaues from the table. When loading the combo boxes I set the option selected to the value of the record but when I click the update button it says my field is null. Why doesn't it recgnize that I loaded/selected a value in the combo box.

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Update Form with Combo Box Values

    Originally posted by realgoldn
    I have a form that I use for both editing and adding. When the form is used for editing I load the fields with vaues from the table. When loading the combo boxes I set the option selected to the value of the record but when I click the update button it says my field is null. Why doesn't it recgnize that I loaded/selected a value in the combo box.
    It will be hard to say without looking at the code. Post your code if possible..
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Using javascript to check the combobox?

  4. #4
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    I take it that you are aware that comboboxes in HTML forms have two values one that appears and one that is sent? Further these form eliments tend to have ID and Name which is a tad confusing too.

    Double check those basic eliments if at all unsure otherwise feel free to ignore me.
    ?
    'What's this bit for anyway?
    For Jono

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    Hmm one that appears and one that is sent? Maybe I am selected the right one to appear but not to send. How do I do that?

    This is how I set up the combo box

    <%
    set rs=server.CreateObject("ADODB.RECORDSET")

    RS.Open "select * from tbl_cap where cip is null order by type,division,id,fy",cn,adOpenStatic,adLockOptimistic
    %>
    <TR>
    <TD>*Cap Number:</TD>
    <TD><SELECT size=1 name=cboCapNum style="WIDTH: 105px">

    <%
    If blnadd Then
    Response.Write "<option selected></option>"
    End If
    Do While NOT RS.EOF
    Type1=rs("type")
    Div=rs("division")
    id=rs("id")
    fy=rs("FY")
    Response.Write "<option value=""" & Type1 & div & ID & FY & """>" & Type1 & div & ID & FY & "</option>"
    RS.MoveNext
    Loop
    RS.close
    set rs=nothing

    If Not blnadd Then
    Response.Write "<option selected="""& rsItem("Cap") &""">"& rsItem("Cap") &"</option>"
    End If

    %>

  6. #6
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    Originally posted by realgoldn
    Response.Write "<option value=""" & Type1 & div & ID & FY & """>" & Type1 & div & ID & FY & "</option>"
    That seems to be over kill. I assume that ID is the unique ID field? so set the vale as "...Value = """ & ID & """>" otherwise you will need to build very big strings to select the record set at the other end.

    Might I also sugest that

    "Type: " & Type1 & " Div:" & div & " ID:" & ID & ":" & FY

    might be simpler to read as out put.

    I can't be sure but it seems the problem might be that you over complicated things.

    Give it a go and tell us what happened.
    ?
    'What's this bit for anyway?
    For Jono

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    thanks for your help!

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