Results 1 to 2 of 2

Thread: why wont this work?..Please Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Posts
    29

    Question

    <!-- #include file = "../include/functions.asp" -->
    <%

    Dim dbData
    Dim rsData
    Dim strSQL
    Dim rsOptions
    Dim CategoryID
    Dim VehicleID
    Dim numincol
    Dim i 'counter
    Dim rsCars
    Dim selected

    selected=false
    set dbData = Server.CreateObject("ADODB.Connection")
    dbData.Open Application("DSN")

    CategoryID = 0
    If Request.Form("CategoryID") <> vbNullString Then CategoryID = Request.Form("CategoryID")

    If Request.Form("VehicleList") = vbNullString Then
    VehicleID = 0
    Else
    VehicleID = CLng(Request.Form("VehicleList"))
    End If

    'Connection to Database
    Set dbData = Server.CreateObject("ADODB.Connection")
    dbData.Open Application("DSN")

    'Connection to Recordsets
    strSQL = "SELECT ID, Description FROM used_options"
    strSQL = strSQL & " Order by Description"
    Set rsOptions = Server.CreateObject("ADODB.Recordset")
    rsOptions.Open strSQL, dbData, 1, 3

    strSQL = "SELECT * From used_cars"
    strSQL = strSQL & " INNER JOIN used_category ON used_cars.CategoryID = used_category.ID"
    strSQL = strSQL & " INNER JOIN used_car_options ON used_cars.CarID = used_car_options.CarID"
    strSQL = strSQL & " INNER JOIN used_options ON used_car_options.OptionID = used_options.ID"
    strSQL = strSQL & " WHERE CategoryID = " & CategoryID 'AND used_cars.CarID = " & VehicleID
    Set rsData = Server.CreateObject("ADODB.Recordset")
    rsData.Open strSQL, dbData, 1, 3
    %>
    <html>
    <head>
    <title>Shaganappi Chevrolet Oldsmobile</title>
    </head>
    <script language="JavaScript">
    var num;
    function openWin()
    {
    var options = 'width=500,height=200,scrollbars=no,top=' + ((screen.availHeight - 200) / 2) + ',left=' + ((screen.availWidth - 500) / 2);
    win=window.open('uploadframe.asp?img=no&path=~images~used_inv~', 'win', options);
    win.imagebox = document.frmUsed.tbImage;
    return;
    }
    function Validate()
    {
    //check to make sure
    if(document.frmUsed.make.value=='' || document.frmUsed.model.value=='' || document.frmUsed.modelyear.value=='' || document.frmUsed.category.value==-1)
    {
    alert("Make, Model, Year, and\nCategory are required fields.");
    return;
    }
    document.frmUsed.save.value='save';
    document.frmUsed.submit();
    }
    function TestNumber(textbox)
    {
    var number=textbox.value;

    number=number.replace(/,/g,'');
    if(number=='')
    return;
    if(isNaN(number))
    {
    textbox.value=num;
    textbox.focus();
    alert('Invalid number.');
    }
    }

    //Load Models
    function LoadMakes()
    {
    document.frmUsed.submit();
    return;
    }
    </script>

    <body bgcolor="#ffffff" alink="#0000ff" vlink="#0000ff" link="#0000ff" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
    <table border="0" cellpadding="0" cellspacing="0" width=750>
    <tr>
    <td colspan="2">
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td><img SRC="../images/layout/layout1a.gif" WIDTH="235" HEIGHT="83"></td>
    <td><img SRC="../images/layout/layout1b.gif" WIDTH="304" HEIGHT="83"></td>
    <td><img SRC="../images/layout/layout1c.gif" WIDTH="211" HEIGHT="83"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td colspan="2" background="../images/layout/layout4.gif" align="right"><img SRC="../images/header/used_admin.gif" WIDTH="525" HEIGHT="55"></td>
    </tr>
    <tr>
    <td height="455" background="../images/layout/layout8.gif" valign="top">
    <img SRC="../images/layout/spacer.gif" width="150" height="1">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td colspan="2"><!-- #include file = "../include/admin_menu.htm" --><!-- #include file = "../include/hover_script.htm" --></td>
    </tr>
    </table>
    </td>
    <td bgcolor="#ffffff" valign="top" align="center" width="410">
    <table border="1" cellpadding="10" cellspacing="0" bordercolor="#000000" bgcolor="#c0c0c0">
    <tr>
    <td>
    <form name="frmUsed" action="newlayout.asp" method="post">
    <table cellSpacing="0" cellPadding="0" width=400 border="1" align="center">
    <tr>
    <td colSpan="5">
    <center>Select the appropriate vehicle type to add to the inventory:</center>
    </td>
    </tr>
    <tr>
    <td>
    <input type="image" onclick="this.form.CategoryID.value=2;" src="../images/masterimages/truck.gif">
    <p>Trucks</p>
    </td>
    <td>
    <input type="image" onclick="this.form.CategoryID.value=1;" src="../images/masterimages/corvette.gif">
    <p>Cars</p>
    </td>
    <td>
    <input type="image" onclick="this.form.CategoryID.value=36;" src="../images/masterimages/mvan.gif">
    <p>Minivans</p>
    </td>
    <td>
    <input type="image" onclick="this.form.CategoryID.value=31;" src="../images/masterimages/blazer.gif">
    <p>SUV's</p>
    </td>
    <td>
    <input type="image" onclick="this.form.CategoryID.value=47;" src="../images/masterimages/van.gif">
    <input type="hidden" name="CategoryID" value="<%=CategoryID%>">
    <p>Vans</p>
    </td>
    </tr>
    </table>
    <br><br>
    <center>
    <font face="arial" size="5" color="#ff0000"><strong><em>
    <%If CategoryID = 2 Then%>
    Trucks
    <%ElseIf CategoryID = 1 Then%>
    Cars
    <%ElseIf CategoryID = 36 Then%>
    Minivans
    <%ElseIf CategoryID = 31 Then%>
    Suv's
    <%ElseIf CategoryID = 47 Then%>
    Vans
    <%End If%>
    </em></strong></font>
    </center>
    <table border="1" cellpadding="10" cellspacing="0" bgcolor="c0c0c0" bordercolor="#000000" width="400" align="center">
    <tr>
    <td colspan="2" align="center">
    <select size="10" name="VehicleList" onchange="LoadMakes();">
    <option value="0" <%If VehicleID = 0 Then Response.Write "selected" End If%>>--------------------------------------------- New Listing ---------------------------------------------</option>
    <%
    Dim rsListing

    strSQL = "SELECT Make, CarID, Year, Model, CategoryID From used_cars"
    strSQL = strSQL & " WHERE CategoryID = " & CategoryID
    strSQL = strSQL & " ORDER BY Make"
    set rsListing=server.CreateObject("ADODB.Recordset")
    rsListing.Open strSQL, dbdata, 1, 3
    If NOT (rsListing.BOF AND rsListing.EOF) Then rsListing.MoveFirst
    do until rsListing.EOF
    %>
    <option value="<%=rsListing.Fields("CarID")%>" <%If VehicleID = rsListing.Fields("CarID") Then Response.Write "selected" End If%>><%=rsListing.Fields("Year")& " " & rsListing.Fields("Make")& " " & rsListing.Fields("Model") %></option>
    <%
    rsListing.MoveNext
    loop
    rsListing.Close
    set rsListing=nothing
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td>
    <font face="arial" size="2">Make</font>&nbsp;<input type="text" value="<%if selected then Response.Write rsListing.Fields("Make")%>">
    </td>

    this last is statement should get the value but it isnt and i do not know y can some please help?

    Thanx Clint

  2. #2
    Guest

    Cool Selected Property

    Hi...
    <Input type="text" value="" name="">

    cannot have "selected ", bcos it is a text box

    that's y u cannot get value.
    May be this will help...

    <font face="arial" size="2">Make</font> <input type="text" value="<%=rsListing.Fields("Make")%>">



    good luck

    Regards,
    Mac

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width