 |
| 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
|
|
|
|

May 24th, 2010, 02:08 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Radio Buttons
Hi,
I have an input form which uses radio buttons. I have no problem with receiving the information from the form and updating the database. The problem arises when I am trying to edit the information and I populate the form with the information from the database. The text boxes fill in with no problelem (I am using ASP and MySQL). However, I have not been able to figure out a way to select a radio button or check or not check the check box. Here is a copy of my code from that section.
Code:
"<legend>Are you making one lump sum payment of 543.10?</legend>" &_
"<label>Yes</label>" &_
"If zFpymt= Yes Then <input type='radio' id='prevYes' name='zFpymt' value='" & rs.Fields("zFpymt") & "' checked> else <input type='radio' id='prevYes' name='zFpymt' value='" & rs.Fields("zFpymt") & "'>" &_
"<label> No</label>" &_
"If zFpymt= No Then <input type='radio' id='prevNo' name='zFpymt' value='" & rs.Fields("zFpymt") & "' checked> else <input type='radio' id='prevNo' name='zFpymt' value='" & rs.Fields("zFpymt") & "'>" &_
"<label> Tentative Pymt Date </label>" &_
"<input type='text' id='pDate' name='zpDate' style='width: 70px' value='" & rs.Fields("zpDate") & "'>" &_
What do you suggest?
Thanks,
Splendor2
|
|

May 24th, 2010, 04:20 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Well, for starters I *STRONGLY* suggest you stop using Response.Write to create major sections of HTML code. Doing so makes the code harder to write, harder to read, harder to maintain, *AND* somewhat slower than just creating the HTML *as* HTML.
The second problem is that No is *NOT* any special value in VBScript code. If you want to check for the value "No", then it needs quote marks around it.
And the major problem is that the VALUE= of the radio button should *NOT* depend on the value from the DB! Only whether it is checked or not should change.
Oh, yes. And it is pointless to have a <label> that doesn't refer to or enclose a form field.
So...
Code:
... asp code ...
%>
<legend>Are you making one lump sum payment of 543.10?</legend>
<label>Yes
<input type="radio" name="zFpymt" value="Yes"
<% If rs("zFpymt") = "Yes" Then Response.Write "checked" %> >
</label>
<label>No
<input type="radio" name="zFpymt" value="No"
<% If rs("zFpymt") = "No" Then Response.Write "checked" %> >
</label>
<label> Tentative Pymt Date
<input type="text" name="zpDate" style="width: 70px" value="<%=rs("zpDate")%>">
</label>
...
<%
' Now back into ASP mode
|
|

May 24th, 2010, 08:46 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Radio Button
I understand what you're saying about the Response.Write, but that the way I was taught. Also, I made the changes and it still doesn't work. I only attached the section of my form that was not working, so this time I have attached a copy of the entire form. Sorry about pasting the entire form
Code:
<%@ Language=VBScript %>
<%Response.Expires = -1 %>
<%Response.ExpiresAbsolute = Now() - 1%>
<%Response.AddHeader "pragma", "no-cache"%>
<%Response.AddHeader "cache-control", "private"%>
<%Response.CacheControl = "no-cache"%>
<%
Response.Expires = -1000
Response.Buffer = True
Response.Clear
%>
<%
Your_Username = Request.Cookies("Username")
%>
<!--#include file="Hallman-Logincheck.asp"-->
<html>
<head>
<!--
The Hallman Family Edit Registration Page
Author: Angela Hicks
Date: 2/12/2010
Filename: Hallman-EditRegistration.htm
Supporting files: back.jpg, left.jpg, vhouse1.jpg, main.css
right.jpg, rforms.css
-->
<title>Your Registration Information: <% Response.Write(Your_Username) %></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="Generator" content="Microsoft ExpressWeb 2.0">
<meta name="description" content="Your source of information for Hallman Family, photos, and news!">
<meta name="keywords" content="Hallman, hallman, Hallman Family, hallman family, Hallman Family Vacation, hallman family vacation, Family Vacation, family vacation">
<meta name="robots" content="All">
<meta name="rating" content="General">
<meta name="distribution" content="Members">
<meta name="classification" content="Recreation">
<meta name="copyright" content="Angela M Hicks">
<meta name="author" content="Angela M Hicks">
<link rel="stylesheet" type="text/css" href="data/css.css">
<link href="styles/main.css" rel="stylesheet" type="text/css">
<link href="styles/rforms.css" rel="stylesheet" type="text/css">
<style type="text/css">
#pymt {
width: 98px;
}
</style>
<script language="javascript" type="text/javascript">
function isValid1(){
var themessage = "You are required to complete the following fields: ";
if (document.EditRegistrationform.zfName.valu=e="") {
themessage = themessage + " - First Name";
}
if (document.EditRegistrationform.zlName.value=="") {
themessage = themessage + " - Last Name";
}
if (document.EditRegistrationform.zAddress.value=="") {
themessage = themessage + " - Street Address";
}
if (document.EditRegistrationform.zCity.value=="") {
themessage = themessage + " - City";
}
if (document.EditRegistrationform.zZip.value=="") {
themessage = themessage + " - Zip";
}
if (document.EditRegistrationform.zPhone.value=="") {
themessage = themessage + " - Phone";
}
if (document.EditRegistrationform.zEmail.value=="") {
themessage = themessage + " - E-mail";
}
if (document.EditRegistrationform.zDate.value=="") {
themessage = themessage + " - Date";
}
if (document.EditRegistrationform.zUsername.value=="") {
themessage = themessage + " - Username";
}
if (document.EditRegistrationform.zPassword.value=="") {
themessage = themessage + " - Password";
}
if (document.EditRegistrationform.zAnswer.value=="") {
themessage = themessage + " - Answer";
}
//alert if fields are empty and cancel form submit
if (themessage = "You are required to complete the following fields: ") {
document.EditRegistrationForm.submit();
}
else {
alert(themessage);
return false;
}
}
function calcTotal()
{
var intPymt1;
var intPymt2;
var intPymt3;
var intPymt4;
var intPymt5;
var intTPymt;
var intTotal;
intPymt1 = document.editregistration.zPymt1.value;
intPymt2 = document.editregistration.zPymt2.value;
intPymt3 = document.editregistration.zPymt3.value;
intPymt4 = document.editregistration.zPymt4.value;
intPymt5 = document.editregistration.zPymt5.value;
intTPymt = (543.10 - intPymt1 - intPymt2 - intPymt3 - intPymt4 - intPymt5);
intTotal = eval(intTPymt);
document.editregistration.zTotal.value=intTotal;
window.alert("Your New Remaining Balance is " + intTotal)
}
</script>
</head>
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.provider="Microsoft.Jet.OLEDB.4.0"
conn.open (Server.mappath("db/db.mdb"))
Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT * FROM Hallman"
sql=sql & " WHERE zUsername = '" & Request.Cookies("Username") & "' "
' Execute SQL statement
rs.open sql, conn
while not rs.eof
If Request.Cookies("Username") = rs("zUsername") Then
Response.Write "<body OnLoad=' & chr(34) & 'document.EditRegistration.zfName.focus();' & chr(34) & '>" &_
"<div id='head'><img src='images/vhouse1.jpg' alt='Vacation Home' height='150' width='830'>" &_
"</div>" &_
"<div id='links'>" &_
"<ul>" &_
"<li><a href='Hallman-Home.asp'>home</a></li>" &_
"<li><a href='photo_gallery/photo_gallery.htm'>photo gallery</a></li>" &_
"<li><a href='event/event.htm'>events</a></li>" &_
"<li><a href='menu/menu.htm'>menu</a></li>" &_
"<li><a href='news/news.htm'>news</a></li>" &_
"<li><a href='direction/direction.htm'>driving direction</a></li>" &_
"<li><a href='http://www.weather.com/weather/today/USFL0372?lswe=Orlando,%20FL,%20United%20States&from=searchbox_typeahead'>weather</a></li>" &_
"<li><a href='Hallman-Logout.asp'>logout</a></li>" &_
"<li><a href='contact/contact.htm'>contact info</a></li>" &_
"</ul>" &_
"</div>" &_
"<div id='mainContent'>" &_
"<div id='leftColumn'>" &_
"</div>" &_
"<div id='rightColumn'>" &_
"<br />" &_
"<br />" &_
"<br />" &_
"<h1>User Information</h1>" &_
"<p><span>*</span>indicates required information</p>" &_
"<form name='editregistration' id='editregistration' action='Hallman-EditUpdate.asp' method='post'>" &_
"<input type='hidden' name='eMail' id='eMail' value='[email protected]'>" &_
"<fieldset id='contactFields'>" &_
"<legend>Contact Information</legend>" &_
"<label class='blockLabel'>" &_
"First Name<span>*</span>" &_
"<input type='text' id='fName' name='zfName' value='" & rs.Fields("zfName") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Last Name<span>*</span>" &_
"<input type='text' id='lName' name='zlName' value='" & rs.Fields("zlName") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Street Address<span>*</span>" &_
"<input type='text' id='address' name='zAddress' value='" & rs.Fields("zAddress") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"City<span>*</span>" &_
"<input type='text' id='city' name='zCity' value='" & rs.Fields("zCity") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"State<span>*</span>" &_
"<input type='text' id='state' name='zState' maxlength='2' value='" & rs.Fields("zState") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Zip<span>*</span>" &_
"<input type='text' id='zip' name='zZip' maxlength='10' value='" & rs.Fields("zZip") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Phone<span>*</span>" &_
"<input type='text' id='phone' name='zPhone' value='" & rs.Fields("zPhone") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Email<span>*</span>" &_
"<input type='text' id='email' name='zEmail' value='" & rs.Fields("zEmail") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Today's Date<span>*</span>" &_
"<input type='text' id='date' name='zDate' value='" & rs.Fields("zDate") & "'>" &_
"</label>" &_
"</fieldset>" &_
"<fieldset id='registrationInfo'>" &_
"<legend>Registration Information</legend>" &_
"<fieldset id='attend' style='width: 479px; font-size: 14px'>" &_
"<legend>Others family members attending</legend>" &_
"<label class='blockLabel'>" &_
"Names" &_
"<input type='text' id='Attend1' name='zAttend1' style='left: 61px; top: 0px; width: 176px;'" &_
"value='" & rs.Fields("zAttend1") & "'>" &_
"<input type='text' id='Attend2' name='zAttend2' style='left: 250px; top: 0px; width: 176px;'" &_
"value='" & rs.Fields("zAttend2") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Names" &_
"<input type='text' id='Attend3' name='zAttend3' style='left: 61px; top: 0px; width: 176px;'" &_
"value='" & rs.Fields("zAttend3") & "'>" &_
"<input type='text' id='Attend4' name='zAttend4' style='left: 250px; top: 0px; width: 176px;'" &_
"value='" & rs.Fields("zAttend4") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"Names" &_
"<input type='text' id='Attend5' name='zAttend5' style='left: 61px; top: 0px; width: 176px;'" &_
"value='" & rs.Fields("zAttend5") & "'>" &_
"<input type='text' id='Attend6' name='zAttend6' style='left: 250px; top: 1px; width: 176px;'" &_
"value='" & rs.Fields("zAttend6") & "'>" &_
"</label>" &_
"<label class='blockLabel'>" &_
"What day of the week will you arrive?" &_
"<select id='daySource' name='zdaySource' value='" & rs.Fields("zdaySource") & "'>" &_
"<option selected value='" & rs.Fields("zdaySource") & "'>" & rs.Fields("zdaySource") & "</option>" &_
"<option value='mon'>Monday</option>" &_
"<option value='tue'>Tuesday</option>" &_
"<option value='wed'>Wednesday</option>" &_
"<option value='thu'>Thursday</option>" &_
"<option value='fri'>Friday</option>" &_
"<option value='sat'>Saturday</option>" &_
"<option value='sun'>Sunday</option>" &_
"</select>" &_
"</label>" &_
"<fieldset>" &_
"<legend>Cost information</legend>" &_
"<fieldset id='payment'>" &_
"<legend>Are you making one lump sum payment of 543.10?</legend>" &_
"<label>Yes" &_
"<input type='radio' id='prevYes' name='zFpymt' value='Yes' 'If rs('zFpymt') = 'Yes' Then Response.Write 'checked = checked'>" &_
"</label>" &_
"<label> No" &_
"<input type='radio' id='prevNo' name='zFpymt' value='No' 'If rs('zFpymt') = 'No' Then Response.Write 'checked = checked'>" &_
"</label>" &_
"<label> Tentative Pymt Date </label>" &_
"<input type='text' id='pDate' name='zpDate' style='width: 70px' value='" & rs.Fields("zpDate") & "'>" &_
"</fieldset>" &_
"<label class='blockLabel'>5 Month Payment Plan of $108.62 monthly</label>" &_
"<strong>" &_
"<center style='color: #ffffff'>Please key in the amount of each payment as you send monthly</center>" &_
"</strong>" &_
"<table cellpadding='6' cellspacing='6' style='text-align: center' align='center'>" &_
"<tr>" &_
"<td style='font-family: Verdana; color: #000000; font-size: 12px'>" &_
"1st Payment</td>" &_
"<td style='color: #000000; font-size: 12px'>Feb 22,2010</td>" &_
"<td style='color: #000000; font-size: 12px'>" &_
"<input type='text' name='zPymt1' size='7' style='width: 80px' value='" & rs.Fields("zPymt1") & "'>" &_
"</td>" &_
"</tr>" &_
"<tr>" &_
"<td style='color: #000000; font-size: 12px'>2nd Payment</td>" &_
"<td style='color: #000000; font-size: 12px'>Mar 15, 2010</td>" &_
"<td><input type='text' name='zPymt2' size='7' style='width: 80px' value='" & rs.Fields("zPymt2") & "'>" &_
"</td>" &_
"</tr>" &_
"<tr>" &_
"<td style='color: #000000; font-size: 12px'>3rd Payment</td>" &_
"<td style='color: #000000; font-size: 12px'>Apr 15, 2010</td>" &_
"<td><input type='text' name='zPymt3' size='7' style='width: 80px' value='" & rs.Fields("zPymt3") & "'>" &_
"</td>" &_
"</tr>" &_
"<tr>" &_
"<td style='color: #000000; font-size: 12px'>4th Payment</td>" &_
"<td style='color: #000000; font-size: 12px'>May 15, 2010</td>" &_
"<td><input type='text' name='zPymt4' size='7' style='width: 80px' value='" & rs.Fields("zPymt4") & "'>" &_
"</td>" &_
"</tr>" &_
"<tr>" &_
"<td style='color: #000000; font-size: 12px'>5th Payment</td>" &_
"<td style='color: #000000; font-size: 12px'>Jun 15, 2010</td>" &_
"<td><input type='text' name='zPymt5' size='7' style='width: 80px' value='" & rs.Fields("zPymt5") & "'>" &_
"</td>" &_
"</tr>" &_
"<tr>" &_
"<td style='color: #000000; font-size: 12px'></td>" &_
"<td style='color: #000000; font-size: 12px'>Remaining Balance</td>" &_
"<td><input type='text' name='zTotal' size='10' value='" & rs.Fields("zTotal") & "'>" &_
"</td>" &_
"</tr>" &_
"</table>" &_
"<input align='right' type='button' value='Calculate your total' name='btnCalculate' onClick='calcTotal()' style='width: 135px'>" &_
"<input align='right' type='reset' value='Clear' name='btnClear'>" &_
"<br>" &_
"<label class='blockLabel'>Please make check or money order payable to Mary Davis and Mail to:" &_
"</label>" &_
"<p>Mary Davis</p>" &_
"<p>13528 Philip Michael Road</p>" &_
"<p>Huntersville, NC 28078</p>" &_
"</fieldset>" &_
"<fieldset id='sizeFields'>" &_
"<legend>What quantity and size shirt would you like to order</legend>" &_
"<br>" &_
"<label id='size1'>" &_
"<select id='CSmall' name='zSize1' style='width: 90px' value='" & rs.Fields("zSize1") & "'>" &_
"<option selected id='CSmall' name='zSize1' style='width: 90px'" &_
"value='" & rs.Fields("zSize1") & "'>" & rs.Fields("zSize1") & "</option>" &_
"<option value='0-Child-Sm'>Child-Sm</option>" &_
"<option value='1-Child-Sm'>1-Child-Sm</option>" &_
"<option value='2-Child-Sm'>2-Child-Sm</option>" &_
"<option value='3-Child-Sm'>3-Child-Sm</option>" &_
"<option value='4-Child-Sm'>4-Child-Sm</option>" &_
"<option value='5-Child-Sm'>5-Child-Sm</option>" &_
"<option value='6-Child-Sm'>6-Child-Sm</option>" &_
"<option value='7-Child-Sm'>7-Child-Sm</option>" &_
"<option value='8-Child-Sm'>8-Child-Sm</option>" &_
"<option value='9-Child-Sm'>9-Child-Sm</option>" &_
"<option value='10-Child-Sm'>10-Child-Sm</option>" &_
"</select>" &_
"</label>" &_
"<label id='size2'>" &_
"<select id='Child-Md' name='zSize2' style='width: 90px' value='" & rs.Fields("zSize2") & "'>" &_
"<option selected id='Child-Md' name='zSize2' style='width: 90px'" &_
"value='" & rs.Fields("zSize2") & "'>" & rs.Fields("zSize2") & "</option>" &_
"<option value='0-Child-Md'>Child-Md</option>" &_
"<option value='1-Child-Md'>1-Child-Md</option>" &_
"<option value='2-Child-Md'>2-Child-Md</option>" &_
"<option value='3-Child-Md'>3-Child-Md</option>" &_
"<option value='4-Child-Md'>4-Child-Md</option>" &_
"<option value='5-Child-Md'>5-Child-Md</option>" &_
"<option value='6-Child-Md'>6-Child-Md</option>" &_
"<option value='7-Child-Md'>7-Child-Md</option>" &_
"<option value='8-Child-Md'>8-Child-Md</option>" &_
"<option value='9-Child-Md'>9-Child-Md</option>" &_
"<option value='10-Child-Md'>10-Child-Md</option>" &_
"</select>" &_
"</label>" &_
"<label id='size3'>" &_
"<select id='Child-Lg' name='zSize3' style='width: 90px' value='" & rs.Fields("zSize3") & "'>" &_
"<option selected id='Child-Lg' name='zSize3' style='width: 90px'" &_
"value='" & rs.Fields("zSize3") & "'>" & rs.Fields("zSize3") & "</option>" &_
"<option value='0-Child-Lg'>Child-Lg</option>" &_
"<option value='1-Child-Lg'>1-Child-Lg</option>" &_
"<option value='2-Child-Lg'>2-Child-Lg</option>" &_
"<option value='3-Child-Lg'>3-Child-Lg</option>" &_
"<option value='4-Child-Lg'>4-Child-Lg</option>" &_
"<option value='5-Child-Lg'>5-Child-Lg</option>" &_
"<option value='6-Child-Lg'>6-Child-Lg</option>" &_
"<option value='7-Child-Lg'>7-Child-Lg</option>" &_
"<option value='8-Child-Lg'>8-Child-Lg</option>" &_
"<option value='9-Child-Lg'>9-Child-Lg</option>" &_
"<option value='10-Child-Lg'>10-Child-Lg</option>" &_
"</select>" &_
"</label>" &_
"<label id='size4'>" &_
"<select id='AMedium' name='zSize4' style='width: 90px' value='" & rs.Fields("zSize4") & "'>" &_
"<option selected id='AMedium' name='zSize4' style='width: 90px'" &_
"value='" & rs.Fields("zSize4") & "'>" & rs.Fields("zSize4") & "</option>" &_
"<option value='0-Adult-Md'>Adult-Md</option>" &_
"<option value='1-Adult-Md'>1-Adult-Md</option>" &_
"<option value='2-Adult-Md'>2-Adult-Md</option>" &_
"<option value='3-Adult-Md'>3-Adult-Md</option>" &_
"<option value='4-Adult-Md'>4-Adult-Md</option>" &_
"<option value='5-Adult-Md'>5-Adult-Md</option>" &_
"<option value='6-Adult-Md'>6-Adult-Md</option>" &_
"<option value='7-Adult-Md'>7-Adult-Md</option>" &_
"<option value='8-Adult-Md'>8-Adult-Md</option>" &_
"<option value='9-Adult-Md'>9-Adult-Md</option>" &_
"<option value='10-Adult-Md'>10-Adult-Md</option>" &_
"</select>" &_
"</label>" &_
"<label id='size5'>" &_
"<select id='ALarge' name='zSize5' style='width: 90px' value='" & rs.Fields("zSize5") & "'>" &_
"<option selected id='ALarge' name='zSize5' style='width: 90px'" &_
"value='" & rs.Fields("zSize5") & "'>" & rs.Fields("zSize5") & "</option>" &_
"<option value='0-Adult-Lg'>Adult-Lg</option>" &_
"<option value='1-Adult-Lg'>1-Adult-Lg</option>" &_
"<option value='2-Adult-Lg'>2-Adult-Lg</option>" &_
"<option value='3-Adult-Lg'>3-Adult-Lg</option>" &_
"<option value='4-Adult-Lg'>4-Adult-Lg</option>" &_
"<option value='5-Adult-Lg'>5-Adult-Lg</option>" &_
"<option value='6-Adult-Lg'>6-Adult-Lg</option>" &_
"<option value='7-Adult-Lg'>7-Adult-Lg</option>" &_
"<option value='8-Adult-Lg'>8-Adult-Lg</option>" &_
"<option value='9-Adult-Lg'>9-Adult-Lg</option>" &_
"<option value='10-Adult-Lg'>10-Adult-Lg</option>" &_
"</select>" &_
"</label>" &_
"<label id='size6'>" &_
"<select id='1XLarge' name='zSize6' style='width: 90px' value='" & rs.Fields("zSize6") & "'>" &_
"<option selected id='1XLarge' name='zSize6' style='width: 90px'" &_
"value='" & rs.Fields("zSize6") & "'>" & rs.Fields("zSize6") & "</option>" &_
"<option value='0-1XLarge'>Adult-1X</option>" &_
"<option value='1-1XLarge'>1-1X</option>" &_
"<option value='2-1XLarge'>2-1X</option>" &_
"<option value='3-1XLarge'>3-1X</option>" &_
"<option value='4-1XLarge'>4-1X</option>" &_
"<option value='5-1XLarge'>5-1X</option>" &_
"<option value='6-1XLarge'>6-1X</option>" &_
"<option value='7-1XLarge'>7-1X</option>" &_
"<option value='8-1XLarge'>8-1X</option>" &_
"<option value='9-1XLarge'>9-1X</option>" &_
"<option value='10-1XLarge'>10-1X</option>" &_
"</select>" &_
"</label>" &_
"<label id='size7'>" &_
"<select id='2XLarge' name='zSize7' style='width: 90px' value='" & rs.Fields("zSize7") & "'>" &_
"<option selected id='2XLarge' name='zSize7' style='width: 90px'" &_
"value='" & rs.Fields("zSize7") & "'>" & rs.Fields("zSize7") & "</option>" &_
"<option value='0-2XLarge'>Adult-2X</option>" &_
"<option value='1-2XLarge'>1-2X</option>" &_
"<option value='2-2XLarge'>2-2X</option>" &_
"<option value='3-2XLarge'>3-2X</option>" &_
"<option value='4-2XLarge'>4-2X</option>" &_
"<option value='5-2XLarge'>5-2X</option>" &_
"<option value='6-2XLarge'>6-2X</option>" &_
"<option value='7-2XLarge'>7-2X</option>" &_
"<option value='8-2XLarge'>8-2X</option>" &_
"<option value='9-2XLarge'>9-2X</option>" &_
"<option value='10-2XLarge'>10-2X</option>" &_
"</select>" &_
"</label>" &_
"<label id='size8'>" &_
"<select id='3XLarge' name='zSize8' style='width: 90px' value='" & rs.Fields("zSize8") & "'>" &_
"<option selected id='3XLarge' name='zSize8' style='width: 90px'" &_
"value='" & rs.Fields("zSize8") & "'>" & rs.Fields("zSize8") & "</option>" &_
"<option value='0-3XLarge'>Adult-3X</option>" &_
"<option value='1-3XLarge'>1-3X</option>" &_
"<option value='2-3XLarge'>2-3X</option>" &_
"<option value='3-3XLarge'>3-3X</option>" &_
"<option value='4-3XLarge'>4-3X</option>" &_
"<option value='5-3XLarge'>5-3X</option>" &_
"<option value='6-3XLarge'>6-3X</option>" &_
"<option value='7-3XLarge'>7-3X</option>" &_
"<option value='8-3XLarge'>8-3X</option>" &_
"<option value='9-3XLarge'>9-3X</option>" &_
"<option value='10-3XLarge'>10-3X</option>" &_
"</select>" &_
"</label>" &_
"<label id='size9'>" &_
"<select id='4XLarge' name='zSize9' style='width: 90px' value='" & rs.Fields("zSize9") & "'>" &_
"<option selected id='4XLarge' name='zSize9' style='width: 90px'" &_
"value='" & rs.Fields("zSize9") & "'>" & rs.Fields("zSize9") & "</option>" &_
"<option value='0-4XLarge'>Adult-4X</option>" &_
"<option value='1-4XLarge'>1-4X</option>" &_
"<option value='2-4XLarge'>2-4X</option>" &_
"<option value='3-4XLarge'>3-4X</option>" &_
"<option value='4-4XLarge'>4-4X</option>" &_
"<option value='5-4XLarge'>5-4X</option>" &_
"<option value='6-4XLarge'>6-4X</option>" &_
"<option value='7-4XLarge'>7-4X</option>" &_
"<option value='8-4XLarge'>8-4X</option>" &_
"<option value='9-4XLarge'>9-4X</option>" &_
"<option value='10-4XLarge'>10-4X</option>" &_
"</select>" &_
"</label>" &_
"</fieldset>" &_
"<label for='comments' class='blockLabel'>Comments</label>" &_
"<textarea id='comment' name='zComment' rows='5' cols='55'>" & rs.Fields("zComment") & "</textarea>" &_
"</fieldset>" &_
"</fieldset>" &_
"<br />" &_
"<input type='submit' name='action' value='Save'>" &_
"<input type='submit' name='action' value='Delete'>" &_
"<input type='button' value='Print' onClick='window.print()'>" &_
"</form>" &_
"<address>" &_
"The Hallman Family Vacation •" &_
"7822 West Irlo Bronso Memorial Hwy. •" &_
"Kissimmee, FL 34747 •" &_
"(704)277-2719 (Mary Davis) •" &_
"</address>" &_
"</div>" &_
"</body>" &_
"</html>"
End If
rs.MoveNext
Wend
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
Thanks for all of the help!!!
|
|

May 25th, 2010, 03:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Quote:
|
I understand what you're saying about the Response.Write, but that the way I was taught.
|
So go beat up the doofus who taught you that way and start learning to do it the right way. And if you paid some school money to learn it that way, ask for your money back.
Long concatenated strings are *poison* to performance in VBScript. AT LEAST if you are going to use Response.Write, break your strings up so they don't get longer than a couple of hundred characters before you Response.Write them. The longer they get, the slower the code.
Yes, I know it doesn't matter for a page like this one, but why use the wrong code for any project?
On top of that, because you are using '...' around attributes in your HTML, it means you are generating obsolete HTML.
Anyway, I can't test it right now. Will try it later.
|
|

May 25th, 2010, 03:13 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
There are lots of other things wrong in that code, you know. Just to pick one example:
Code:
"<select id='2XLarge' name='zSize7' style='width: 90px' value='" & rs.Fields("zSize7") & "'>" &_
"<option selected id='2XLarge' name='zSize7' style='width: 90px'" &_
"value='" & rs.Fields("zSize7") & "'>" & rs.Fields("zSize7") & "</option>" &_
(1) You can't give the same id= to more than one object. Oh, you can, but then anything that tries to refer to that id will not be able to find any of the multiply-named objects.
(2) You can't give an id= to an <option>, in any case.
(3) You can't give a name= to an <option>.
(4) You can't assign a value= to a <select> in the <select> tag itself, as you are doing.
(5) You can't assigne a width to an individual <option> via a stye=. (About the only styles that can be applied to <option>s are color and background-color. And a couple of less useful ones.)
(And it's not an error, at all, but there's really no point in assigning the same value= to an <option> as you give in its text. HTML will send the text as the value of the <select> if no value= is specified.)
(None of that has anything to do with ASP, per se. Just fundamentals of legal HTML.)
Last edited by Old Pedant; May 25th, 2010 at 03:16 PM..
|
|

May 25th, 2010, 04:51 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Radio Button
So how do I fix my radio button problem.
|
|

May 25th, 2010, 06:05 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
*sigh*
Okay.
Code:
...
"<label>Yes <input type='radio' name='zFpymt' value='Yes' "
' end of prior response.write!
If rs('zFpymt') = "Yes" Then Response.Write "checked"
Response.Write "></label>" &_
"<label> No <input type='radio' id='prevNo' name='zFpymt' value='No' "
' end of prior response.write!
If rs('zFpymt') = "No" Then Response.Write "checked"
Response.Write "></label>" &_
...
You *must* do the IF check *OUTSIDE* the Response.Write.
|
|

May 26th, 2010, 09:35 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Radio Button
Thank you, Thank you and once again THANK YOU!!!
|
|
 |