Solved

Run asp script with on change of input field

Posted on 2014-07-29
6
345 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

758 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

17 Experts available now in Live!

Get 1:1 Help Now