|
-
Mar 31st, 2004, 02:49 PM
#1
Thread Starter
Addicted Member
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.
-
Mar 31st, 2004, 11:14 PM
#2
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 : 
-
Apr 1st, 2004, 12:54 AM
#3
Using javascript to check the combobox?
-
Apr 1st, 2004, 06:11 AM
#4
Fanatic Member
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.
-
Apr 1st, 2004, 09:16 AM
#5
Thread Starter
Addicted Member
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
%>
-
Apr 5th, 2004, 05:22 AM
#6
Fanatic Member
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.
-
Apr 6th, 2004, 02:52 PM
#7
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|