Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Display

Status
Not open for further replies.

chinedu

Technical User
Mar 7, 2002
241
0
0
US
I have got a page that is intended to display more than one record per userid.
Here is an example:
I have a page called displayJustify.asp which has 7 form objects.
Each has a single record but one field called Specifications is intented to have multiple values.

As a result, you will have a result similar to this:
Userid
1
FullName
Pete Samprass

Address
122 samprass dr

Specifications yes No
'Samprass is a tennis player' yes
'Samprass is a 13 time wimbledon champion' yes
'Samprass won the us open in 2001' yes

As you can see from above example, there is only one userid
but there are 3 specifications entered for that userid.The total number of specifications could be less than 3 or more than 3.
I was wondering if there is a way to code this form to dynamically keep opening up new rows until all values for specifications and Yes/No field are displayed on the form.
I know I will have to add paging to navigate from page to page but that is critical right now.
Here is the page.


<html>
<head>
<title>Display Justifications</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;ffffff&quot;>

<%
set my_conn= Server.CreateObject(&quot;ADODB.Connection&quot;)

myDSN=&quot;DSN=justify&quot;

'response.write mydsn

'response.end

my_Conn.Open myDSN

strsql =&quot;SELECT * FROM tbl_persons, tbl_events WHERE tbl_persons.justifyID = tbl_events.eventID &quot;

set rs = my_conn.Execute (StrSql)

'response.write(&quot;strsql&quot;)

'response.end

if rs.BOF or rs.EOF then ' No records found

response.write &quot;Hmm... That didn't work.<br>There was an error. Oh well, try again.<a href=javascript:history.back();>back</a>&quot;

response.end

end if

%>


<form name=&quot;display&quot; method=&quot;post&quot; action=&quot;displayjustification.asp&quot;>
<p><center><b>FC <BR>DPW</b></center></p>
<div align=&quot;center&quot;>
<table width=&quot;88%&quot; border=&quot;1&quot; bordercolor=&quot;000000&quot;>
<tr>
<td>
<div align=&quot;left&quot;>
<table><tr><td><b>TITLE: SPECIFICATION FOR A </b></td><td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='40' NAME='txtSpecName' VALUE='&quot; & rs(&quot;SpecName&quot;) & &quot;' >&quot;)
%>
</td><td><b>OR EQUAL.</b></td></tr></table>
</div>
<div align=&quot;left&quot;>
<table>
<tr>
<td>
<p>
</td>
</tr>
<br><br>
<tr>
<td><b>
**NOTE**
</b></td>
</tr>
<tr>
<td>
<b>THE</b>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='40' NAME='txtOfferName' VALUE='&quot; & rs(&quot;OfferName&quot;) & &quot;' >&quot;)
%>
</td>
<td>
<b>OFFERED SHALL BE</b>
</td>
</tr>
</table>
</div>
<p>
<b>COMPARABLE WITH THE DETAILED REQUIREMENTS LISTED BELOW<br>
UNLESS OTHERWISE NOTED. ALL BIDDERS SHALL INDICATED EXACTLY<br>
WHAT THEY ARE OFFERING IN THE FOLLOWING BLANKS UNDER<br>
&quot;BIDDERS RESPONSE&quot;. ALL EXCEMPTIONS TO NON COMPLYING<br>
DETAILED FEATURES MUST BE IDENTIFIED AND EXPLAINED
</b></p>

<div align=&quot;left&quot;>
<table>
<tr>
<td>
<b>MAKE & MODEL PROPOSED</b>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='40' NAME='txtMakeModel' VALUE='&quot; & rs(&quot;MakeModel&quot;) & &quot;' >&quot;)
%>
</td>
</tr>
<tr>
<td>
<b>ALTERNATE MAKE & MODEL PROPOSED</b>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='40' NAME='txtAlternateModel' VALUE='&quot; & rs(&quot;AlternateModel&quot;) & &quot;' >&quot;)
%>
</td>
</tr>
</table>
</div>
<br>
<div align=&quot;left&quot;>
<table>
<tr>
<td>
<font color=&quot;green&quot;><b>*&nbsp;All Vendors Must Mark &quot;Yes&quot; or &quot;No&quot; To Comply With Each Individual Specification Below.</b></font>
</td>
</tr>
</table>
</div>
<table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td>Specifications </td>
<td align=&quot;right&quot;>Yes</td>
<td align=&quot;right&quot;>No</td>
</tr>
<tr>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='80' NAME='txtItemDesc' VALUE='&quot; & rs(&quot;ItemDesc&quot;) & &quot;' >&quot;)
%>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='2' NAME='txtYes' VALUE='&quot; & rs(&quot;TheYes&quot;) & &quot;' >&quot;)
%>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='2' NAME='txtNo' VALUE='&quot; & rs(&quot;TheNo&quot;) & &quot;' >&quot;)
%>
</td>
</table>
</div>
<div align=&quot;left&quot;>
<table>
<tr>
<td>
<b>FOR ADDITIONAL INFORMATION PLEASE CONTACT</b>
</td>
</tr>
</table>
</div>
<div align=&quot;left&quot;>
<table>
<tr>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='28' NAME='txtContactName' VALUE='&quot; & rs(&quot;ContactName&quot;) & &quot;' >&quot;)
%>
</td>
<td>
<b>AT</b>
</td>
<td>
<%
Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='28' NAME='txtContactEmail' VALUE='&quot; & rs(&quot;ContactEmail&quot;) & &quot;' >&quot;)
%>
</td>
</tr>
</table>
</div>
</table>
</div>
</form>
</body>
</html>


Thanks all in advance
 
Hi Gary!
My apology, I went to a meeting and then home from there.
To answer your question, what we need on the display page is when values for specifications are displayed, blank yes or no checkboxes are also displayed.
There will be no values for the checkboxes because the client will manually check their answers after printing the form.
Gary, let me explain briefly what is going on here.
every year, our purchasing dept goes to sites such as IBM, Microsoft, Dell etc to purchase electronic equipments and other periperals.
After purchasing, each individual dept within my company will then pick up equipments based on their needs.
Before picking up equipments, each individual representative must agree to a series of service agreements by clicking yes or no.
Those service agreements could be 1 or 15 or even more.
My company has therefore decided to make these agreements database-driven.
As a result, they need to have those services and their accompany yes or no checkboxes in the database.
Due to my limited asp experience, I can't think of a way of copying the entire service agreement with their yes or no checkboxes into one form.
I decided to code the insert statement whereby you can create one line of service agreement with yes or no or N lines with their yeses or nos.
So now, I need to find a way to say when displaying information about a particular user, show one service agreement, if only one service agreement is entered with yes or no boxes or show N service agreements with their yeses or nos.
There are other form objects as you can see from the example but the only ones that need to be displayed dynamically are the specifications and their yeses and nos.
Sorry about this long explanation.
 
Not quite sure if I'm following.
In your database for every client you have numerous agreements. Are these agreements the same no matter who has them i.e. you have 15 different types of agreement and each piece of equipment falls into one of these agreement categories?



 
How about something like...

Code:
<%Do While not rs.eof%>
<tr>
     <td>
     <%
        Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='80' NAME='txtItemDesc' VALUE='&quot; & rs(&quot;ItemDesc&quot;) & &quot;' >&quot;)
    %>
     </td>
      <td>
     <%
        Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='2' NAME='txtYes' VALUE='&quot; & rs(&quot;TheYes&quot;) & &quot;' >&quot;)
    %>
      </td>
      <td>
     <%
        Response.Write(&quot;<INPUT TYPE='TEXT' SIZE='2' NAME='txtNo' VALUE='&quot; & rs(&quot;TheNo&quot;) & &quot;' >&quot;)
    %>
      </td>
</tr>
<%
rs.movenext 'I can't remember if this is the exact right syntax, so check it...
Loop
%>

or have you tried that already?

B
 
Gary asks:
-----------------------------------------------------------
Are these agreements the same no matter who has them i.e. you have 15 different types of agreement and each piece of equipment falls into one of these agreement categories?
---------------------------------------------------------
Gary, good question and that's what makes it difficult.
They are different and they are done by line items.
So one service agreement could be 1 line of question that requires to check yes or no.
It could be several lines and each line requires a yes or no answer.
My insert page captures all of that.
In my insert page, the line of question defaults to one question with one yes or no.
However, the page I coded gives you the ability to click the &quot;add&quot; button to add additional input boxes (they act as lines) and one you click the add button, another yes or no is created with it.
So you have something like:

Question Yes No
---------------------- -- --

The dashed lines represent input boxes.
You then copy and paste another question into the input box.
Once all your questions are copied, you press submit to submit to the database.
What is expected to happen is that the client will go to our site (sorry it is intranet) and query the database based on agreement number.
Once that is displayed, they will print it out and then manually check yes or no to each service line agreement.
Each agreement number(userId) migh contain one line of service agreement or several lines but each line must be accompanied by each yes or no to the right of the service agreement.

My database design has 2 tables.
One for person entering data and one for service agreement.
So in a sense, you have one userid on person table, and the same userid id will be on the service table.
So if for instance 5 service agreement are entered, the service table will have one userid on each service agreement (5 of the same userid) and 5 different serviceIDs.
I hope I have not confused things more.
 
is there anyone else who can take a stab at this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top