ASP and JavaScript newbie question

Discussion in 'ASP General' started by Mark B, Jan 24, 2006.

  1. Mark B

    Mark B Guest

    Hi all,

    I'm the IT Support guy for a school. They run a resource booking Access
    database that the manager would like to convert to a web page.

    I have nearly done so, using pure ASP to draw the web page, retrieve the
    bookings info from an SQL database. It looks quite nice, and thus far, works
    pretty well!

    I have come completely unstuck when using the "OnChange" event for all the
    textboxes that display the current bookings, or lack of a booking, for a
    day/session.

    I have inserted |onChange=txtOnChange(this.value,this.name," & chr(34) &
    Rsrce & chr(34) & "," & chr(34) & mnth & chr(34) & ")| (ignore the pipes -
    they're for readability only) which calls a client side JavaScript function
    (receiving four variables) to update the database.

    This script works fine except for the fact that IE or whatever browser warns
    "the web site may not be trusted. Continue?" when attempting (in the
    Javascript function) to connect to the SQL database and update the record.

    Since I cannot change the security settings for every person's browser, and
    I have to use a client side JavaScript function to update the database, is
    it possible to merely have the JavaScript function call a server side .ASP
    file and update the record that way?

    Something like:-

    <SCRIPT TYPE="text/javascript">
    <!--
    function txtOnChange(txtNewValue,txtID,Resource,txtMonth)
    {
    <a
    href=http://myserver/updaterecord.asp?w=txtNewValue&x=txtID&y=Resource&z=txtMonth
    </a>
    }
    </SCRIPT>

    Since I'm pretty new to ASP, and even newer to JavaScript, what is the
    correct way to launch an ASP fille (with variables) from within a JavaScript
    function? Can it in fact be done? (especially with the browser not warning
    the viewer of security issues?)

    Be kind...

    Thanks,

    Mark
     
    Mark B, Jan 24, 2006
    #1
    1. Advertisements

  2. Mark B

    dNagel Guest

    Mark B wrote:
    > Hi all,
    >
    > I'm the IT Support guy for a school. They run a resource booking Access
    > database that the manager would like to convert to a web page.
    >
    > I have nearly done so, using pure ASP to draw the web page, retrieve the
    > bookings info from an SQL database. It looks quite nice, and thus far, works
    > pretty well!
    >
    > I have come completely unstuck when using the "OnChange" event for all the
    > textboxes that display the current bookings, or lack of a booking, for a
    > day/session.
    >
    > I have inserted |onChange=txtOnChange(this.value,this.name," & chr(34) &
    > Rsrce & chr(34) & "," & chr(34) & mnth & chr(34) & ")| (ignore the pipes -
    > they're for readability only) which calls a client side JavaScript function
    > (receiving four variables) to update the database.
    >
    > This script works fine except for the fact that IE or whatever browser warns
    > "the web site may not be trusted. Continue?" when attempting (in the
    > Javascript function) to connect to the SQL database and update the record.
    >
    > Since I cannot change the security settings for every person's browser, and
    > I have to use a client side JavaScript function to update the database, is
    > it possible to merely have the JavaScript function call a server side .ASP
    > file and update the record that way?
    >
    > Something like:-
    >
    > <SCRIPT TYPE="text/javascript">
    > <!--
    > function txtOnChange(txtNewValue,txtID,Resource,txtMonth)
    > {
    > <a
    > href=http://myserver/updaterecord.asp?w=txtNewValue&x=txtID&y=Resource&z=txtMonth
    > </a>
    > }
    > </SCRIPT>
    >
    > Since I'm pretty new to ASP, and even newer to JavaScript, what is the
    > correct way to launch an ASP fille (with variables) from within a JavaScript
    > function? Can it in fact be done? (especially with the browser not warning
    > the viewer of security issues?)
    >
    > Be kind...
    >
    > Thanks,
    >
    > Mark
    >
    >
     
    dNagel, Jan 24, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Smith
    Replies:
    0
    Views:
    337
    Eric Smith
    Oct 21, 2003
  2. Bob [BVP]
    Replies:
    5
    Views:
    1,019
    Bob [BVP]
    Aug 9, 2004
  3. =?Utf-8?B?QW5kcmVhcyBIb2ZtYW5u?=

    Newbie question: migrating "global variables" from ASP to ASP.NET

    =?Utf-8?B?QW5kcmVhcyBIb2ZtYW5u?=, Apr 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    837
    =?Utf-8?B?QW5kcmVhcyBIb2ZtYW5u?=
    Apr 18, 2005
  4. verci
    Replies:
    1
    Views:
    521
    Teemu Keiski
    Feb 12, 2007
  5. Grey Alien

    Newbie question (asp controls and events)

    Grey Alien, Jul 9, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    465
    Dariusz Tomon
    Jul 9, 2007
  6. Jerry C.
    Replies:
    8
    Views:
    586
    Uri Guttman
    Nov 23, 2003
  7. moonhkt
    Replies:
    2
    Views:
    357
    Chris Angelico
    Sep 16, 2012
  8. Dennis Lee Bieber

    Re: Newbie to python. Very newbie question

    Dennis Lee Bieber, Apr 7, 2013, in forum: Python
    Replies:
    1
    Views:
    158
    Miki Tebeka
    Apr 8, 2013
Loading...