Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2003, 08:55 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default saving dynamiccally generated fields into Access

Hi folks,

I need some help with an application i am working on.

Depending on the users input in the first page i generate tables to enter data in a second screen. The number of field generated depend on the users selection in the first screen. Therefor I am not able to predict the number of data fields i will have to save into an access Database. All fields (mostly text boxes) have a a name generated dynamically in a loop the names are composed dynamically from field name & counter value the counter value comes from the loop creating the fields depending on the users input. So far so good - but how do I save all those values into the database - since i cant predict how many fields are being generated? Any help here??

Toran
__________________
... there is always more to learn...
 
Old June 25th, 2003, 09:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If i understood it correct the value of the counter is equal on the number of values being generated.

Harold
 
Old June 25th, 2003, 09:10 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes... that's it...
if it loops three times the fields are named "field1" "field2" "field3"
 
Old June 25th, 2003, 09:16 AM
Authorized User
 
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

so is your problem solved now? or wasn't this what u needed to know?
 
Old June 25th, 2003, 09:22 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

lol... nope that's not quite it ... generating the fields was easy enough... the next pagehowever has to save these fields into an access database... (two different tables) now i know my field is called "field & counter" but i never know howmany fields are actually generated to be saved... does that make sense to you? or would you rather see the loop i use to create the fields?
 
Old June 25th, 2003, 09:26 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here is the code i use to generate the table to hold the values.... it might help you to understand

<%

if tblCase = 0 or tblCase = " " Then
Response.write ("")
else
    objRS.MoveFirst
    While Not objRS.eof 'cycle through to find the searchstring
        strCriteria = "CriteriaName LIKE '" & strSearchCC & "'"
        objRS.filter = strCriteria 'filter all records with the serchstring
        if not objRS.eof THEN 'write the header for the table
            Response.write "<table border='1'><tr><td><b>Criteria Name</b></td><td align ='center' colspan='"
            Response.write tblCase + tblCase & "'><b>Status</b></td></tr><tr><td></td>" 'detect the colspan and doubble it

                    FOR varCounter = 1 to tblCase 'as long as the counter is not greater than the # stored in the table loop through the record
                    response.write "<td><input type = 'text' value = 'Asset' name ='strAsset" & intCountCase & "' size ='6'></td><td>Comment</td>" 'assining a uniquie dynamic name to each input box for the assetNr.
                    Next

            Response.write "</tr>"

                objRS.MoveFirst ' move to the beginning of the file collection with the filter applied
                While not objRS.eof
                    Response.write "<tr><td>" & objRS("CriteriaName") & "</td>" 'write the name for each criteria in a cell
                        for table = 1 to tblCase 'assining a dynamic name for each select list value
                        intCountCase = intCountCase + 1
                        response.write "<td><select name='strCase" & intCountCase & "'> <option value=''></option><option value='NA'>N/A</option><option value='met'>Met</option><option value='NotMet'>Not Met</option><option value='serious'>seriously N/M</option></select></td>"
                        Response.write "<td align='center'><input type='radio' name='radioCase" & intCountCase & "'onClick='popupDescription()'></td>" 'assining a dynamic name for each button
                        Next
                    objRS.MoveNext
                Wend
                Response.write "</table><br><br>" 'close the table
        End if
    Wend
end if
%>

tblCase is the value (from the page before) that actually gives you the number of fields i need to create
 
Old June 25th, 2003, 09:46 AM
Authorized User
 
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i'm gonna take a fresh look at that tomorrow morning...it's now almost 5 pm and time to go home :D
 
Old June 25th, 2003, 09:47 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a bunch... bedankt u well...(i think)
 
Old June 25th, 2003, 09:49 AM
Authorized User
 
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Toran
 thanks a bunch... bedankt u well...(i think)
Nice try with the dutch
 
Old June 25th, 2003, 09:51 AM
Authorized User
 
Join Date: Jun 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thought it was worth a try...:D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access input controls generated by Client Script vinod_yadav1919 ASP.NET 2.0 Professional 3 April 14th, 2008 08:33 PM
saving tables that are generated by queries as HTM miamikk SQL Language 0 October 17th, 2006 04:17 PM
Export from Access to Excel in ASP generated page u0107 Classic ASP Basics 1 July 16th, 2006 05:25 AM
HTML content in Outlook Emails generated by Access Justine Access VBA 0 January 13th, 2004 04:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.