Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 August 18th, 2003, 04:21 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help on dynamically creating an online application

I have a admin form where the user is able to change the field values of an application form, or the title of it. I made this possible by just storing the field names in Access, and gave them the option of making the field inactive, or having a checkbox next to the field value instead of a textbox.

The trouble i am having is to find a way to create an online application form where it pulls in the new field values from the database, and puts it on the online form, ANd also see if the admin made the field value a checkbox, or textbox and display that also.

database looks like this:

Field name | checkbox | active
--------------------------------------
Name yes yes
Address no no


etc...


- So the admin, changed the field name to "NAME" and wants a checkbox next to it, and it is an active field on the form.
- Or admin changed the field name "Address" to no checkbox, and it is inactive, meaning that it wont appear on the online application.

So basically i really need help on how to do this or any ideas, to let the user be able to change the field values, and then display controls dynamically on a form which is going to be emailed when the user click submit button.

I need major help, because im fresh out of college and i need this gig =)


Thank you.

 
Old August 18th, 2003, 04:24 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One more thing is one of my freinds advised me to just create a form with a bunch of controls that are hidden.....

 
Old August 19th, 2003, 03:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Something like this, maybe?
Code:
...
' get data from the table
Set rs = connName.Execute("SELECT * FROM TableName")

' write the opening form tag
Response.Write("<form ...>")

' loop thro the records building the form
Do While Not rs.EOF

  ' if field is not active, don't display it
  If rs.Fields("Active").Value Then

    ' write the field name
    sName = rs.Fields("Field name").Value
    Response.Write(sName)

    ' is it a check box or an input box?
    If rs.Fields("checkbox").Value Then
      Response.Write("<input type='checkbox' name='chk" & sName & "'>")
    Else
      Response.Write("<input type='text' value='' name='txt" & sName & "'>")
    End If
    Response.Write("<br>")

  End If
Loop

' write the closing form tag
Response.Write("</form>")
...
 
Old August 19th, 2003, 09:42 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the help. So im guessing there is no way i can format the results, because it seems like it just list the values straight down?

And if i do it on the fly, i can still email the form right? thanks guys.

 
Old August 19th, 2003, 09:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

What sort of formatting do you want? I just gave you some basic code as an example. You can Response.Write any HTML you like to get it into a different format (e.g. put the form into an HTML table with fields across multiple columns). You can also add extra fields to the database entries and use them to control formatting.

If you want the records ordered in a particular way you can add an ORDER BY clause to the SQL.

re the email - it doesn't matter how the page has been created, static or dynamic, you can still email the results.

rgds
Phil
 
Old August 19th, 2003, 10:07 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OH okay, I will format it in tables and stuff... Thanks for the ideas.. I am going to test it out and hope everything works! thanks again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Application similar to Online Diary gsrai31 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 April 19th, 2008 08:41 AM
Online exam Application--Urgent!!!! e.suni .NET Framework 1.x 5 December 29th, 2007 07:52 AM
Online quiz/testing application takwirira ASP.NET 1.x and 2.0 Application Design 7 March 5th, 2007 03:17 PM
Online Quiz Application in ASP rathnamv ASP.NET 1.x and 2.0 Application Design 1 February 19th, 2007 11:39 AM





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