473,569 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Attributes.Add Onclick (javascript) trapping CANCEL

re: Attributes.Add Onclick (javascript) trapping CANCEL

Hello. The following asp.net/vb.net code produces a confirmation

Submitbutton.At tributes.Add("o nClick", "return confirm('Is this
okay?')")

My question is, when the confirmation comes up, I want cancel to do a
back. Currently it just stops the form from posting.

any suggestions?
Nov 20 '07 #1
1 8094
Don't return the value from confirm. If you need to know that it was canceled
you would need to store that value somewhere in the page and then let it post.

if (confirm('Is this okay?'))
{
//ok logic
}
else
{
//cancel logic
}
return true; //form will post back

"jobs" wrote:
re: Attributes.Add Onclick (javascript) trapping CANCEL

Hello. The following asp.net/vb.net code produces a confirmation

Submitbutton.At tributes.Add("o nClick", "return confirm('Is this
okay?')")

My question is, when the confirmation comes up, I want cancel to do a
back. Currently it just stops the form from posting.

any suggestions?
Nov 21 '07 #2

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

Similar topics

5
10763
by: Jim Bond | last post by:
Hello, I have found myself in the position of having to manage & "hack" a web site built by someone else. I am trying to make a modification to the javascript code and have been unable to get this working. I admit that I am a total javascript beginner, but have read google & purchased the o'reilley javascript book. So far, all I've been...
2
478
by: Cathy | last post by:
Has anyone ever made a webform button run an onClick event that is a Javascript in the HTML code and then after running the script make it go into the code-behind? An HTML button will run the onClick event but will not return to the code-behind. I need to get back to the code, which the webform button will do but I can't make it execute the...
5
10867
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the...
0
2200
by: Ryan Taylor | last post by:
Hello. I am having another issue. I need to execute some JavaScript whenever a radio button is clicked. I am currently using a RadioButtonList control to generate the radio buttons because of its excellent ability to be bound to a datasource. No matter what I do though, I am not able to add an onclick event to the individual radio buttons...
1
1231
by: Mantorok | last post by:
Hi all I'm adding some controls in Page_Load and want to add an attribute: control.Attributes = "test"; However, can I access this attribute from javascript? Thanks Kev
3
9107
by: adbo_atoz | last post by:
Hello All I am trying to duplicate this code which works in IE to work in Firefox <SCRIPT LANGUAGE="javascript"> function submitOnEnterKey() { if(event.keyCode == 13) { event.returnValue = false; } else { event.cancelBubble = true
8
9035
by: nkoriginal | last post by:
Hi: (this is a dummy question, I know, but I tried many times and I cant) I need to insert this javascript option inside the input, I can't insert any funtion in <head> I've this two javascript: javascript:document.form.xrthistory.disabled=false javascript:document.form.prevert.disabled=false
2
2099
by: Safalra | last post by:
Recently I've rewritten much of my old Javascript code to use DOM functions so that enhancements can be attached to documents without needing to alter the HTML code. I assumed that adding event handlers to document.body would have the same effect as adding those event handlers through attributes of the body element, but this turned out not to...
4
3601
by: Muhammad Qaiser | last post by:
Dears I am trying to run a simple bgsound script. But i dont know why its not working. The code is as follows. <script language="javascript"> function changeBgSound(arg){ document.getElementById("mysound").src=arg; } </script> <body> <bgsound id="mysound" src="cphfinan.wav">
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.