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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML/Java Script - Select values

Status
Not open for further replies.

cfcProgrammer

Programmer
Mar 1, 2006
88
CA
Hi Everyone,

Please be patient with me, I'm very new to this HTML/ASP/Java Script world. My background is in RPG AS400. Two different development worlds all together. :)

I am simply trying to create a drop down box within HTML and validate the selection. I am getting an error stating that an "Object is expected".

Can someone help me figure out what it is that I am missing or not understanding about this coding technique?


Code:
<table class=MsoNormalTable border=0 cellpadding=0 width=875 style='width:656.25pt;
 mso-cellspacing:1.5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
  <td colspan=3 style='padding:.75pt .75pt .75pt .75pt'>
  <h3 align=center style='text-align:center'><span style='mso-fareast-font-family:
  "Times New Roman";color:black'><!-- Begin Layout Header --><!-- End Layout Header -->DFO
  Reports<o:p></o:p></span></h3>
  <div align=center>
  <table class=MsoNormalTable border=1 cellpadding=0 width=434
   style='width:325.25pt;mso-cellspacing:1.5pt;border:none;border-bottom:solid windowtext 1.0pt;
   mso-border-bottom-alt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
   <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
    <td width=146 valign=top style='width:109.85pt;border:none;padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=right style='text-align:right'><b><span
    style='font-size:10.0pt;font-family:Arial;color:black'>Report Name:<o:p></o:p></span></b></p>
    </td>
    <td valign=top style='border:none;padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal><a name="OLE_LINK1"></a><a name="OLE_LINK2"><span
    style='mso-bookmark:OLE_LINK1'><span style='font-size:10.0pt;font-family:
    Arial;mso-fareast-font-family:"Times New Roman";color:black'><SELECT NAME="lstReportName">
<OPTION VALUE="-1">---Please Select a Report---</option>
<option Value="1">Fish Status Report by Area</option>
<option Value="2">AIS Commercial Vessels</option>
<option Value="3">Summary of Patrol Hours by Fishery</option>
<option Value="4">Summary of Patrol Details by Area</option>
<option Value="5">Summary of Patrol Sightings – Fishing Vessels by Area</option>
<option Value="6">Aerial Surveillance Program—Program Result</option>
<option Value="7">Air Surveillance Program - Fixed Wing Aircraft—Monthly Totals</option>
<option Value="8">DFO Aerial Surveillance Program—SIS Usage By Month</option>

</SELECT><o:p></o:p></span></span></a></p>

Then on an on_click function of a button I am trying to validate the selection by running the following code. The form name is f1 and the selection is defaulted to display "Please select a report" this holds the value of -1.

Code:
function cmdShow_onclick() {

 // Check for an entry in the Report field.

    if f1.lstReportName.selectedIndex() ==-1{
       Session("svError")="You <i>must</i> choose a REPORT to run";
        Response.Redirect("/error.asp");
    }

Thanks in advance for any guidance you may be able to provide to me.

If I haven't included enough of the code to explain what it is I am trying to accomplish, I will post more.

Again Thank you for your help.

cfcProgrammer
 
Since you're new to web programming, I'll make 2 suggestions:

First, you should really drop front-page like a bad habit. WYSIWYG editors won't teach you anything about web development. If you're serious about learning how to program for the web, pull up notepad and do it from scratch. You will learn 100000% more about web development than you will by using a program that writes the code for you (and does a terrible job of it, to boot)

Second, before you write even one more line of code, you should read some of these links:


In the code you've posted above, you're attempting to check a javascript condition (client-side) to run ASP commands (server-side). This is one of the most basic fundamentals that you need to understand when working with a server-side language. Good luck with getting started, and if you have any more questions you can come back to ask - or check out the link in my signature.

-kaht

<. is live!
Please visit us at
 
Thank you so much Kaht. Your advice is greatly appreciated and I will review those links immediately. I'm sure I'll be back with questions. Again your advice adn guidance is greatly appreciated.

Cfcprogrammer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top