the onchange() function without using JavaScript

Results 1 to 2 of 2

Thread: the onchange() function without using JavaScript

  1. #1
    Bob Sabbagh Guest

    Default the onchange() function without using JavaScript

    I really need help here. I have a page with 2 dynamic linked list boxes and one table. When the user selects an option from on of the list boxes, i am supposed to run retreive the value of the option clicked, give it to the SQL statement, open a recordset and put the recordset in a table.<BR>The problem is that the onchange() function is written in JavaScript and i am having a hard time doing the code in <BR>javascript (especially how to connect to the database and open a recordset).<BR>Is there a way to call an ASP code when the onchange() function is called? if no,can anyone tell me how to do it in JavaScript.<BR><BR>Is there a way to do it other than the onchange() function (without using JavaScipt).

  2. #2
    Back to basics... Guest

    Default RE: the onchange() function without using JavaScri

    You have a fundamental misunderstanding of the relationship between client-side coding/scripting (typically, JavaScript and HTML or DHTML) and server-side coding/scripting as is done with ASP.<BR><BR>An "onChange" event happens *IN THE BROWSER*. <BR><BR>ASP can not see *ANYTHING* that happens in the browser until and unless you ask it to produce the next page. Typically, you do this by submitting a &#060;FORM...&#062; or invoking a URL via an HREF. Then, and only then, the info from the page is available to ASP via Request.Form or Request.QueryString, at which point ASP is ready to produce the *NEXT* page to be displayed. ASP *CAN NOT* affect the current page as it sits in the user&#039s browser. <BR><BR>[There is an oddball exception to this known as Remote Scripting, but I can&#039t suggest that you even think about that option until after you have successfully mastered the basics.]<BR><BR>So go get yourself a *good* ASP book (see Scott&#039s book, on the left, for example) and learn the principles.<BR><BR>Incidentally, what you are trying to do is well documented on many sites. Try, for example, and search for "dynamic lists" or "dynamic listboxes".<BR><BR>You have two options: (1) Load all the data for all possible entries in the second list box ahead of time and let client-side JS change the entries, as needed. (2) Use the JS "onChange" to submit the form to ASP and have the ASP code then reconstruct the page with the new listbox contents. In any case, it is the<BR>cooperation between client-side JS and server-side ASP that you need to learn how to do, since doing it with only one or the other is either not possible or not the best option.<BR><BR>Good luck.<BR><BR>

Posting Permissions

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