Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: JavaScript to create Multiple choice Questionnaire ASP


Message #1 by stephen_marrs@h... on Thu, 22 Aug 2002 08:55:43
People here bristle at being asked to do your homework.  The problem reeked
of schoolwork all along, which is probably why you didn't get responses.

All you really need to do is repeat what was done for size with the other
criteria.  If you wrote the existing code yourself you should have no
problem writing the rest.  If not then the class is too advanced and I
suggest dropping it while you can still get a refund.

Greg


-----Original Message-----
From: stephen_marrs@h... [mailto:stephen_marrs@h...]
Sent: Thursday, August 22, 2002 1:01 PM
To: javascript
Subject: [javascript] Re: JavaScript to create Multiple choice
Questionnaire ASP


> Hello,I need help to create a form in JavaScript that uses ASP to allow
u> sers to choose between different criteria which will query a db and
r> eturn a list of suitable dog breeds to them using ASP and JavaScript.
T> he criteria are Size,Grooming,Exercise and Space and each of these has
t> he following attributes to choose from,e.g.Considerable(Con),Moderate
(> Mod) or Little(Lt)and in the case of size S,M,L and XL.
T> his is what I have come up with so far

> <%@ LANGUAGE = JavaScript%>
<> HTML>
<> BODY>
 > <h3>Dog Breed Selector</h3>
 > <p>Please choose what Size of dog you would prefer:</p>
 > <form>
 > <table>
 > <td><input type='radio' name='size' value='S'>Small</td>
 > <td><input type='radio' name='size' value='M'>Medium</td>
 > <td><input type='radio' name='size' value='L'>Large</td>
 > <td><input type='submit' value='Find a Dog'></td>

> <%
/> / Open connection to database, then populate a recordset with list of
s> tock
 >   var adoConnection = Server.CreateObject("ADODB.Connection");
 >   var adoRecordSet;
 >   var mySQL;
 >   adoConnection.Open("DSN=DogDSN");
 >   var mySQL = "SELECT BreedName" +
 >      " FROM Breeds WHERE Size='" & Request.Form('size')&"'";
 >   adoRecordSet = adoConnection.Execute(mySQL);

> // Loop through recordset and write Breed Names out to page
 >   while ( adoRecordSet.Eof == false )
 >   {
%> >
<> TR>
 >   <TD><%=adoRecordSet("BreedName").Value%></TD>
 >
 >
 >
<> /TR>
<> %
 >   adoRecordSet.MoveNext();
 >   }

> // Close Recordset and connections
/> / and release memory used by Recordset and Connection objects
 >   adoRecordSet.Close();
 >   adoRecordSet = null;
 >   adoConnection.Close();
 >   adoConnection = null;
%> >
<> %Response.Write(Request.Form("size"))
%> >

> </BODY>

> What would I need to change and add to this to meet my requirements?

>

I would be very grateful for any help with this as I need it urgently for
a College project that is due on Monday

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20



  Return to Index