Solved

Run asp script with on change of input field

Posted on 2014-07-29
6
346 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

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 32

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now