473,803 Members | 3,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checkboxes

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.<scr ipt

<!--
function pruefen(){retur n true}
-->
</script>
<script language="JAvaS cript1.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="retur n pruefen(this)"> </form>

Thank you
Jul 20 '05 #1
4 2901
"BjoernJackschi na" <ja*******@hotm ail.com> wrote in message
news:a2******** *************** ***@posting.goo gle.com...
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.<scr ipt

<!--
function pruefen(){retur n true}
-->
</script>
<script language="JAvaS cript1.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="retu rn pruefen(this)". And
"this" means this form. Use:

f.elements
<form onSubmit="retur n pruefen(this)"> </form>

Jul 20 '05 #2
BjoernJackschin a 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.<scr ipt
My reply to your original contains more elaborate response. Please
read that after this.
<!--
function pruefen(){retur n true}
-->
</script>
<script language="JAvaS cript1.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="someFu nction(this)">

someFunction() is passed a reference to an Input (in JS) or
HTMLInputElemen t (in DOM) object with the id, eg1.

<FORM id="eg2" ... onsubmit="someF unction(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="someF unction(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="retur n pruefen(this)"> </form>


Don't forget to read my reply to your original post.

Mike

--
Michael Winter
M.******@blueyo nder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #3
"Vjekoslav Begovic" <vj*******@inet .hr> wrote in message news:<bq******* ***@ls219.htnet .hr>...
"BjoernJackschi na" <ja*******@hotm ail.com> wrote in message
news:a2******** *************** ***@posting.goo gle.com...
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.<scr ipt

<!--
function pruefen(){retur n true}
-->
</script>
<script language="JAvaS cript1.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="retu rn pruefen(this)". And
"this" means this form. Use:

f.elements
<form onSubmit="retur n 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.leng th;i++).
What could be the problem. I couldn't find it.

Many thanks
Jul 20 '05 #4
Michael Winter <M.******@bluey onder.co.uk.inv alid> wrote in message news:<Xn******* *************** *********@193.3 8.113.46>...
BjoernJackschin a 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.<scr ipt


My reply to your original contains more elaborate response. Please
read that after this.
<!--
function pruefen(){retur n true}
-->
</script>
<script language="JAvaS cript1.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="someFu nction(this)">

someFunction() is passed a reference to an Input (in JS) or
HTMLInputElemen t (in DOM) object with the id, eg1.

<FORM id="eg2" ... onsubmit="someF unction(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="someF unction(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="retur n 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

Jul 20 '05 #5

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

Similar topics

2
3966
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 checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
8
2833
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 boxes and saving to the database at the end with the 'Submit' command button. Is it possible to save the changes as the checkboxes are clicked? I suppose I'd need to write some dynamic ASP event handling at the same time as creating the checkboxes......
8
2842
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 is my code line that creates each checkbox (the php variable get
5
5895
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 "Done" button and then have a script which uses a "for" loop to check the status of each box. The code I use for this is Sample checkbox HTML <P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox0"
6
2850
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++) checkboxes.checked=thestate } This works fine - but the problem is that it doesn't work with my
2
3196
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 user clicks on a certain button on the page, which is not in the grid, I want to be able to traverse through all the checkboxes in that column and see how many are checked. This is so that I can give them a confirmation dialog before I do an action...
10
5212
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. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
5
11282
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: for (int i = 0; i < 160; i++) { string checkbox = "checkBox" + i.toString(); (Cast)checkbox.enabled = false;
8
6043
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 ideal case I would like to see all of the source code for a complete working example of a ListBox of CheckBoxes.
7
2295
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 checkbox of macrocategory A, M and T checkboxes all disabled; 2-b) If I select the checkbox of macrocategory M, A and T checkboxes all disabled; 2-c) If I select the checkbox of macrocategory T, A and M checkboxes all disabled; 3) If I select the...
0
10548
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...
0
10316
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
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
9125
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5500
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...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
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.