Solved

Run asp script with on change of input field

Posted on 2014-07-29
6
351 Views
Last Modified: 2014-08-03
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
Comment
Question by:robrodp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
ID: 40227171
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
 

Assisted Solution

by:robrodp
robrodp earned 0 total points
ID: 40227179
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
 

Author Comment

by:robrodp
ID: 40227182
It doesnt matter ifit reloads the page
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 33

Accepted Solution

by:
Big Monty earned 250 total points
ID: 40227188
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
 
LVL 33

Expert Comment

by:Big Monty
ID: 40227200
just a heads up, you can just click on the "Split Points" links under each answer you want to accept.
0
 

Author Closing Comment

by:robrodp
ID: 40237109
That got me going...

Thz
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question