HEllo,
I still have always the same problem with a no object form in my
source code.
It is for checking out used radiobuttons or checkboxes.<script
<!--
function pruefen(){return true}
-->
</script>
<script language="JAvaScript1.1"><!--
function pruefen(f){
var i;
var k=0;
document.forms[f].elements; /* this sould be an object form but I
can't find the syntax-mistake */
for(i=0; i < f.elem.length; i++){
if ('checkbox' == elem[i].type)
{
if(elem[i].checked)
k++;
}
}return true;
}
/* So actually I need k for continue. Maybe it has to give back k ? */
<form onSubmit="return pruefen(this)"></form>
Thank you 4 2879
"BjoernJackschina" <ja*******@hotmail.com> wrote in message
news:a2**************************@posting.google.c om... HEllo, I still have always the same problem with a no object form in my source code. It is for checking out used radiobuttons or checkboxes.<script
<!-- function pruefen(){return true} --> </script> <script language="JAvaScript1.1"><!--
language attribute is deprecated, type attribute is required
function pruefen(f){ var i; var k=0; document.forms[f].elements; /* this sould be an object form but I can't find the syntax-mistake */
f is object allready since you have "onSubmit="return pruefen(this)". And
"this" means this form. Use:
f.elements
<form onSubmit="return pruefen(this)"></form>
BjoernJackschina wrote on 02 Dec 2003: HEllo, I still have always the same problem with a no object form in my source code. It is for checking out used radiobuttons or checkboxes.<script
My reply to your original contains more elaborate response. Please
read that after this.
<!-- function pruefen(){return true} --> </script> <script language="JAvaScript1.1"><!-- function pruefen(f){ var i; var k=0; document.forms[f].elements; /* this sould be an object form but I can't find the syntax-mistake */
No, it should *not*!! When you use the this operator in an event
handler, it evaluates to an object reference of the element it is in.
For example:
<INPUT id="eg1" type="checkbox" onclick="someFunction(this)">
someFunction() is passed a reference to an Input (in JS) or
HTMLInputElement (in DOM) object with the id, eg1.
<FORM id="eg2" ... onsubmit="someFunction(this)">
someFunction() is passed a reference to a Form (in JS) or
HTMLFormElement (in DOM) object with the id, eg2.
If you had a form, such as this one:
<FORM name="myForm" onsubmit="someFunction(this)">
....and this function:
function someFunction( obj ) {
// Here, obj would be the same as using document.forms['myForm']
}
for(i=0; i < f.elem.length; i++){
if ('checkbox' == elem[i].type) { if(elem[i].checked) k++; } }return true; } /* So actually I need k for continue. Maybe it has to give back k ? */
To answer that, you need to tell us (and I said this in my other
reply) what the validator is checking, what is a success condition,
and what is a failure condition. You said that you checked k - for
what? Where will you check it?
<form onSubmit="return pruefen(this)"></form>
Don't forget to read my reply to your original post.
Mike
--
Michael Winter M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
"Vjekoslav Begovic" <vj*******@inet.hr> wrote in message news:<bq**********@ls219.htnet.hr>... "BjoernJackschina" <ja*******@hotmail.com> wrote in message news:a2**************************@posting.google.c om... HEllo, I still have always the same problem with a no object form in my source code. It is for checking out used radiobuttons or checkboxes.<script
<!-- function pruefen(){return true} --> </script> <script language="JAvaScript1.1"><!--
language attribute is deprecated, type attribute is required
function pruefen(f){ var i; var k=0; document.forms[f].elements; /* this sould be an object form but I can't find the syntax-mistake */
f is object allready since you have "onSubmit="return pruefen(this)". And "this" means this form. Use:
f.elements
<form onSubmit="return pruefen(this)"></form>
Hello,
if I use f.elements I have the problem with a part of the for-loop. So
it is to object to ( i=0;i < f.elements.length;i++).
What could be the problem. I couldn't find it.
Many thanks
Michael Winter <M.******@blueyonder.co.uk.invalid> wrote in message news:<Xn*******************************@193.38.113 .46>... BjoernJackschina wrote on 02 Dec 2003:
HEllo, I still have always the same problem with a no object form in my source code. It is for checking out used radiobuttons or checkboxes.<script
My reply to your original contains more elaborate response. Please read that after this.
<!-- function pruefen(){return true} --> </script> <script language="JAvaScript1.1"><!-- function pruefen(f){ var i; var k=0; document.forms[f].elements; /* this sould be an object form but I can't find the syntax-mistake */
No, it should *not*!! When you use the this operator in an event handler, it evaluates to an object reference of the element it is in. For example:
<INPUT id="eg1" type="checkbox" onclick="someFunction(this)">
someFunction() is passed a reference to an Input (in JS) or HTMLInputElement (in DOM) object with the id, eg1.
<FORM id="eg2" ... onsubmit="someFunction(this)">
someFunction() is passed a reference to a Form (in JS) or HTMLFormElement (in DOM) object with the id, eg2.
If you had a form, such as this one:
<FORM name="myForm" onsubmit="someFunction(this)">
...and this function:
function someFunction( obj ) { // Here, obj would be the same as using document.forms['myForm'] }
for(i=0; i < f.elem.length; i++){
if ('checkbox' == elem[i].type) { if(elem[i].checked) k++; } }return true; } /* So actually I need k for continue. Maybe it has to give back k ? */
To answer that, you need to tell us (and I said this in my other reply) what the validator is checking, what is a success condition, and what is a failure condition. You said that you checked k - for what? Where will you check it?
<form onSubmit="return pruefen(this)"></form>
Don't forget to read my reply to your original post.
Mike
Hello Mike, I will test your tipps but I can give you an answer only tomorrow. Many thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pete |
last post by:
There is a Summary/Example further down...
On page one of my site I have a form with some checkboxes and detailed
descriptions. When the form is submitted (to page two), the values of
the...
|
by: DylanM |
last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the...
|
by: Ralph Freshour |
last post by:
I have multiple checkbox's created with an array name because I have
many on the same web page - their names are like:
frm_chk_delete
frm_chk_delete
frm_chk_delete
frm_chk_delete
etc.
Here...
|
by: @(none) |
last post by:
I have a page which is a set of CheckBoxes generated daily and thus the
number of Checkboxes changes each day.
What I want to do is allow the user to select one or more checkboxes and
the push a...
|
by: terence.parker |
last post by:
I currently have the following JS in my header:
function checkall(thestate) {
var checkboxes=eval("document.forms.EssayList.file_id")
for (i=0;i<checkboxes.length;i++)...
| |
by: john |
last post by:
I posted this question to comp.lang.javascript but didn't get a
response, so I'll try here.
I am using ASP.NET and I have a datagrid. One of the columns in my
grid is all checkboxes. When the...
|
by: rn5a |
last post by:
All the rows in a DataGrid, including the Header, are accompanied with
a CheckBox. I want that when the CheckBox in the Header is checked,
then all the CheckBoxes should automatically get checked....
|
by: masterej |
last post by:
Developers,
Is there any way to disable all checkboxes on a form? I have a form
with 160 checkboxes and I want to be able to disable all of them. Is
there a way I can do something like this:
...
|
by: PeteOlcott |
last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html
I would like to completely understand how GUI controls such as this
one are constructed. In the...
|
by: viki1967 |
last post by:
I need one function javascript that:
1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled;
2-a) If I select the...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |