Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / September 2008



Tip: Looking for answers? Try searching our database.

ASP Web Form Database Pull Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 08 Sep 2008 17:57 GMT
So I have an online submission form that submits info to a Access
database. I also have a second page where the user can update their
info on the form (which pulls the data from the database of course).
The text fields pull fine, but I'm having problems pulling data of
Dropdowns, Checkboxes, and Radio Buttons. For instance, if someone had
selected a checkbox from the submission form, when they go to the
"update" form, the checkbox would be checked.

Any help is much appreciated.
Phil Grimpo - 08 Sep 2008 22:06 GMT
You'd use if>then statements in your dropdown or checkbox or radio button.

<%IF rs_data("Option") = x then Response.Write("Selected")%>

You'll have to put that on every option possibility.

-g

> So I have an online submission form that submits info to a Access
> database. I also have a second page where the user can update their
[quoted text clipped - 5 lines]
>
> Any help is much appreciated.
Mike Brind [MVP] - 09 Sep 2008 08:19 GMT
If you are populating the Select element from a recordset, here's a more
elegant way:

Sub doDropDownMatch(sql,sSelect,iMatch,oConn)
Dim rsDDL, arrDDL, dloop
 Set rsDDL = oConn.execute(sql)
 Response.Write "<select name=""" & sSelect & """>" & vbcrlf
Response.Write "<option></option>" & vbcrlf
 If Not rsDDL.EOF Then
  arrDDL = rsDDL.Getrows()
  rsDDL.Close : Set rsDDL = Nothing
   For dloop = 0 to  Ubound(arrDDL,2)
    Response.Write "<option value=""" & arrDDL(0,dloop) & """"
    If IsNumeric(iMatch) Then
     If Clng(arrDDL(0,dLoop)) = Clng(iMatch) Then Response.Write "
selected=""selected"""
    End If
    Response.Write ">" & arrDDL(1,dloop) & "</option>" & vbcrlf
   Next
 Else
  rsDDL.Close : Set rsDDL = Nothing
 End If
Response.Write "</select>"
End Sub

You'd just pass in the following arguments: the SQL that needs to be
executed, the html name attribute you want to give the Select element, the
(integer) value you want to match, and an open connection object.

--
Mike Brind
MVP - ASP/ASP.NET

> You'd use if>then statements in your dropdown or checkbox or radio button.
>
[quoted text clipped - 13 lines]
>>
>> Any help is much appreciated.
Jason - 10 Sep 2008 14:27 GMT
> If you are populating the Select element from a recordset, here's a more
> elegant way:
[quoted text clipped - 48 lines]
>
> - Show quoted text -

Here's the original code:

<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="Yes" />Yes
&nbsp;&nbsp;
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="No" />No

///////////////////////////////////////

So it would be changed to this:

<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="<%IF
rs_Student("Option") = Yes then Response.Write("Selected")%>" />Yes
&nbsp;&nbsp;
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="<%IF
rs_Student("Option") = No then Response.Write("Selected")%>" />No
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.