473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

can an event be controled in classical ASP?

Hi all,
I guess this probably a very silly question. I am not sure if this can be
done in classical asp. A button has to be clicked if a selection in drop
down list has been changed. If not, a pop up message pops and reminds the
user you need to click the button before continue. Can this be done in some
ways???
Thank you!
--
Betty
Feb 20 '07 #1
5 2000
c676228 wrote:
Hi all,
I guess this probably a very silly question. I am not sure if this
can be done in classical asp. A button has to be clicked if a
selection in drop down list has been changed. If not, a pop up
message pops and reminds the user you need to click the button before
continue. Can this be done in some ways???
Thank you!
--
Not in asp. ASP is server-side technology. If your question concerns
buttons clicked by users to trigger client-side (browser) events, then
you are no longer in the realm of ASP. A client-side scripting group
such as .scripting.jscript will likely get you more help.

Having said that, you need to think more about your sequence of events.
At what point do you want to have the message appear? From your question
it appears that a user has to select an item and then click a button.
What does the user need to do to trigger the error message?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 20 '07 #2
Hello Betty,

I'm wondering whether you're wantting to perform such event/checking every
time before the user submit the form/page or do you want to do such
event/checking whenever the user has changed the selected item in
dropdownlist(html select)?

In both cases, you need to use client side script code. For the first case,
you can add a script handler for html form's onsubmit event. e.g.

<form onsubmit="xxx()">

and in that handler, you can check whether the dropdownlist(or other
element)'s value has been changed(you need to also keep the original value
for compare in the page), and then determine whether to continue the submit
or cancel it and display a alert dialog.
e.g.

=========================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function form_submit()
{
if(document.getElementById("flag").value == "1")
{

return true;
}
else
{
alert("need set flag...");
return false;
}
}

function set_flag()
{
document.getElementById("flag").value = "1";

alert(document.getElementById("flag").value);
}
</script>
</head>
<body>
<form id="form1" action="" onsubmit="return form_submit();">
data: <input type="text" value="test" /><br />
<input type="button" value="set flag" onclick="set_flag();" />

<input id="flag" type="hidden" value="0" />

<input type="submit" value="submit button" />

</form>
</body>
</html>
======================================
if it is the second case, you just need to add "onchange" client-side event
for the dropdownlist and do the checking(whether the button has been
clicked) and show alert.

Does this help?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Feb 21 '07 #3
Bob and Steven,
Thank you both for your help. Steven, your post is very helpful.
My case is the second. Whenever there is a change in any dropdownlist
fields, the update button needs to be clicked for new quote. Based on your
idea, I can always
set original values in session variables and when submit button is clicked,
I can check if the request("filedname") is the same as each session variable
or not, if there is any difference and the flag value is still 0 and alert
user the "update" button needs to be clicked, if the flag=1 then continue...
the only thing I don't like my part is if there are many fields, that means
I need to use many session variables. I am afraid if too many users abandon
in the middle of processing, I could be in trouble. I usually abondon the
session right after a successful transaction, can you give me a
recommendation how to guarantee a session is removed even a user abandons it
in the middle? or do you have any other suggestion?
Thank you
--
Betty
"Steven Cheng[MSFT]" wrote:
Hello Betty,

I'm wondering whether you're wantting to perform such event/checking every
time before the user submit the form/page or do you want to do such
event/checking whenever the user has changed the selected item in
dropdownlist(html select)?

In both cases, you need to use client side script code. For the first case,
you can add a script handler for html form's onsubmit event. e.g.

<form onsubmit="xxx()">

and in that handler, you can check whether the dropdownlist(or other
element)'s value has been changed(you need to also keep the original value
for compare in the page), and then determine whether to continue the submit
or cancel it and display a alert dialog.
e.g.

=========================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function form_submit()
{
if(document.getElementById("flag").value == "1")
{

return true;
}
else
{
alert("need set flag...");
return false;
}
}

function set_flag()
{
document.getElementById("flag").value = "1";

alert(document.getElementById("flag").value);
}
</script>
</head>
<body>
<form id="form1" action="" onsubmit="return form_submit();">
data: <input type="text" value="test" /><br />
<input type="button" value="set flag" onclick="set_flag();" />

<input id="flag" type="hidden" value="0" />

<input type="submit" value="submit button" />

</form>
</body>
</html>
======================================
if it is the second case, you just need to add "onchange" client-side event
for the dropdownlist and do the checking(whether the button has been
clicked) and show alert.

Does this help?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Feb 23 '07 #4
Hello Betty,

Thanks for your reply.

So I think your further question here is how to avoid using many session
variables to mark the flag of those input fields or status. I think this is
just like how to avoid do the checking at server-side. As mentioned in my
first approach, you can use "onsubmit" event of html <formto do
client-side validation and cancel the submit if necessary. For example,
whenever the update button is clicked, you can change a html input hidden
field in your page's cilent-side markup. Then, your client-side script can
check both the value changed (on the dropdownlist) and whether the update
button is clicked(from the hiddenfield). And when all rquirement meet, you
let the page submit to server-side and process it, after successful
processing, you need to reset that hiddenfield(for flag whether update
button has been clicked) to the initial value. How do you think of this?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Feb 26 '07 #5
Thank you, Steven. You are absolutely right. Thank you so much for the help.
--
Betty
"Steven Cheng[MSFT]" wrote:
Hello Betty,

Thanks for your reply.

So I think your further question here is how to avoid using many session
variables to mark the flag of those input fields or status. I think this is
just like how to avoid do the checking at server-side. As mentioned in my
first approach, you can use "onsubmit" event of html <formto do
client-side validation and cancel the submit if necessary. For example,
whenever the update button is clicked, you can change a html input hidden
field in your page's cilent-side markup. Then, your client-side script can
check both the value changed (on the dropdownlist) and whether the update
button is clicked(from the hiddenfield). And when all rquirement meet, you
let the page submit to server-side and process it, after successful
processing, you need to reset that hiddenfield(for flag whether update
button has been clicked) to the initial value. How do you think of this?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Mar 9 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Joh | last post by:
hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = would like to produce : , , , ,
0
by: Andy Read | last post by:
Hello all, I have the requirement to produce source code that produces an object hierarchy. Example: Root | Folder 1
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
8
by: Jerry | last post by:
Hi, My app is controled by a treeview. Each node brings a subform for input and calculations to the front. The subforms are loaded as controls on the main form. Dim ctl As Control For Each...
10
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Recently, a couple of our clients have asked if it is possible for them to pass data in xml format to our server program for processing it. Would you please give me some guide lines or...
1
by: xavierselvaraj | last post by:
I want to handle errors that occur in my classical asp pages in global.asa and redirect them to custom error page. This can be accomplished in global.asax via Application_Error event. Is there...
1
ashitpro
by: ashitpro | last post by:
Hi there, I am working on a distributed service detection project, written in C/C++ Platform is Linux. Each system under network has mysql database for general storage. If first node queries to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.