473,790 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Onclick return function malfunctioning in IE

Hi guys,

<input class="btn" type="submit" name="terminate " value="Terminat e"
onclick="return check_proc_sel( )" />

i have returned false from check_proc_sel( ) but still the form's
submit event is called
It works properly in Firefox but not in IE.
solutions???

regards,
vimal
Jul 24 '08 #1
7 1893
SAM
vimal a écrit :
Hi guys,

<input class="btn" type="submit" name="terminate " value="Terminat e"
onclick="return check_proc_sel( )" />

i have returned false from check_proc_sel( ) but still the form's
submit event is called
It works properly in Firefox but not in IE.
solutions???
Je ne suis pas devin !

Without knowing what dooes the function : no solution !
If something in the function stops it in error whith IE, probably
'false' is not returned ?

always to prefer the solution in form tag

<form onsubmit="retur n check_proc_sel( )" blah >
....
<input type=submit class="btn" value="Terminat e">
</form>

--
sm
Jul 24 '08 #2
SAM wrote on 24 jul 2008 in comp.lang.javas cript:
<input type=submit class="btn" value="Terminat e">
OT, but according to Dr Who it should be:

<form action='http://www.youtube.com/watch?v=c4UJiBm VEMk'>
<input type=submit class="Dalek" value="Extermin ate">
</form>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 24 '08 #3
The function is as follows:

function check_proc_sel( ){
var field = document.procs. process_checked ;
var count = 0;
for (i=0;i&lt;field .length;i++){
if (field[i].checked==true) {
count += 1;
}
}
if (count == 0){
alert("No process selected to Terminate or Kill")
return false;
}
else{
return true;
}
}

vimal
Jul 24 '08 #4
SAM
vimal a écrit :
The function is as follows:
Try :

function check_proc_sel( ){
var field = document.procs. process_checked ;
if(typeof field == 'undefined')
{
alert('no such field');
return false;
}
var count = 0;
for (i=0, n = field.length; i<n; i++)
{
if (field[i].checked) count++;
}
if (count == 0)
{
alert("No process selected to Terminate or Kill")
field.focus();
return false;
}
return true;
}
And use the onsubmit in tag form
instead of onclick in submit button

--
sm
Jul 24 '08 #5
On Jul 24, 1:33 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
wrote:
vimal a écrit :
The function is as follows:

Try :

function check_proc_sel( ){
var field = document.procs. process_checked ;
if(typeof field == 'undefined')
{
alert('no such field');
return false;
}
var count = 0;
for (i=0, n = field.length; i<n; i++)
{
if (field[i].checked) count++;
}
if (count == 0)
{
alert("No process selected to Terminate or Kill")
field.focus();
return false;
}
return true;
}

And use the onsubmit in tag form
instead of onclick in submit button

--
sm
IE script debugger shows error in the following line

line ===field.focus( );
error ===object doesn't support this property

vimal
Jul 24 '08 #6
SAM
vimal a écrit :
On Jul 24, 1:33 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
wrote:
>>
function check_proc_sel( ){
var field = document.procs. process_checked ;
if(typeof field == 'undefined')
{
alert('no such field');
return false;
}
var count = 0;
for (i=0, n = field.length; i<n; i++)
{
if (field[i].checked) count++;
}
if (count == 0)
{
alert("No process selected to Terminate or Kill")
field.focus();
return false;
}
return true;
}
>
IE script debugger shows error in the following line

line ===field.focus( );
error ===object doesn't support this property
doesn't understand that IE didn't display the message
"not such field" ? !

is(are) this(these) 'process_checke d' is(are) checkbox(es) ?

try :

alert ("No process selected to Terminate or Kill");
if(field[0]) field[0].focus();
return false;

--
sm
Jul 24 '08 #7
On Jul 24, 3:31*am, vimal <cool.vimalsm.. .@gmail.comwrot e:
Hi guys,

<input class="btn" type="submit" name="terminate " value="Terminat e"
onclick="return check_proc_sel( )" />

i have returned false from check_proc_sel( ) but still the form's
submit event is called
It works properly in Firefox but not in IE.
solutions???

regards,
vimal
Is it neccessary to do it this way?

How about:
<form ..... onsubmit="check _proc_sel()">
...
</form>

<script type='text/javascript'>
function check_proc_sel( )
{
I'm checkin but I don't like what I find so...
return false;
}
</script>

Bob
Jul 25 '08 #8

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

Similar topics

8
3690
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function and passes it two parameters. For the life of me I cannot figure out what the error is, but one occurs everytime I click a &%*$&# radio button. Also, the function only alerts the user immediately as to what question/answer they clicked. I am...
6
42235
by: waste | last post by:
hello. is it possible to clear onClick event? eg: <div ... onClick="someFunction()"> when I want to run someFunction() only once. -- waste
5
10886
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 href URL (the > onClick function does get executed, but seems to be ignored). > ...
2
9183
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
3
3271
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement "return promptBeforeOpening();" FF and IE rewrite it as I would expect them to, but it turns out that that doesn't work (no disclaimer pops up, and the link is not disabled):
17
4885
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick event ? I've tried something like this: oncl = document.getElementById('mySpan').onclick oncl = oncl + '\n;alert(\'added\')' document.getElementById('mySpan').onclick = oncl
8
28867
by: Barkster | last post by:
I have two functions on buttons onclick, they work but if the first fails the second still runs. How can I prevent this? Simplified Code below. Thanks Function Function1 () { if (something) { return false }
10
4082
by: Carlos Araya | last post by:
I have the following link on a web page <p class="menuitem"><a href="#" onclick="loadFragment('http://rivendellweb.net/fortress/home', 'index')" title="The Fortress Home">The Fortress Home</a></p>
3
3220
by: lewnussi | last post by:
I am trying to call more than one function starting with onclick in a form to work in all browsers. In the form, this calls only function_1: <input type="submit" value="thevalue" name="goodname" onclick="return function_1(this.form);function_2(this.form);" /> So I tried only function_1 for the onclick, and put this in a .js file, but it also does not call function_2: function function_1(health)
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10147
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6770
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
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
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.