Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

Run asp script with on change of input field

I have a form with a checkbox. I need to run an asp script when it is changed (checked/unchecked)

I am sure I have to use an onChange() JavaScript function but I have no clue as to how to run the asp code.

Any ideas
0
robrodp
Asked:
robrodp
  • 3
  • 2
3 Solutions
 
GaryCommented:
ASP doesn't run in the browser, you can use ajax to execute a ASP on the server
What is supposed to happen when the checkbox is changed?
0
 
robrodpAuthor Commented:
The checkbox is stored in a field in an ms sql table. If clicked change it to on or off as is the case.

I I can get the on change to run the script even if it runs it on the server (as if it was the action in the form) I will be fine,
0
 
robrodpAuthor Commented:
It doesnt matter ifit reloads the page
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you're correct, you would use the onchange() event in javascript. as Gary pointed out, you need to use ajax, or you can submit the form and use POST/GET to get your data to run your asp script (you're not referring to running a vbs file are you?)

you can use this as an example:

your html:
<input type="checkbox" name="chk1" value="1" onchange="document.formName.submit()" />

Open in new window


your server side code:
<%
if Request.Form("chk1") = "1" then        '-- assuming POST here
     '-- run your asp script
end if
%>

Open in new window

0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
just a heads up, you can just click on the "Split Points" links under each answer you want to accept.
0
 
robrodpAuthor Commented:
That got me going...

Thz
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now