ASP and JavaScript newbie question

M

Mark B

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
 
D

dNagel

Mark said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top