473,385 Members | 1,876 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,385 software developers and data experts.

Onclick return function malfunctioning in IE

Hi guys,

<input class="btn" type="submit" name="terminate" value="Terminate"
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 1877
SAM
vimal a écrit :
Hi guys,

<input class="btn" type="submit" name="terminate" value="Terminate"
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="return check_proc_sel()" blah >
....
<input type=submit class="btn" value="Terminate">
</form>

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

<form action='http://www.youtube.com/watch?v=c4UJiBmVEMk'>
<input type=submit class="Dalek" value="Exterminate">
</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 <stephanemoriaux.NoAd...@wanadoo.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 <stephanemoriaux.NoAd...@wanadoo.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_checked' 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.comwrote:
Hi guys,

<input class="btn" type="submit" name="terminate" value="Terminate"
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
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...
6
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
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...
2
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...
3
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...
17
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...
8
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)...
10
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...
3
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"...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.