473,508 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splice Method Question

8 New Member
Hello,
I am trying to save information from a text box if the checkbox is selected. The checkboxes are dynamically created with php from mysql tables, so I don't know the index of the array that I would like to delete. My plan is use javascript to delete the null values from the textboxes so the length of that element will correspond with the length of the checkbox element, but I can't figure out how to use the splice method correctly...
I have this function called with onsubmit...

Expand|Select|Wrap|Line Numbers
  1.    function DoTheCheck(form){
  2.   var i = 0;
  3.   var j = form.elements['programs[]'].length;
  4.   for(i=0;i<j;i++){
  5.   if (form.elements['programs[i]'].value==''){
  6.     form.elements['programs[i]'].splice(form.elements['programs[i]'].value(i,1);
  7.   }
  8.   }
  9.   }
  10.  
  11.  
Any help would be greatly appreciated.
Jul 9 '08 #1
1 1248
acoder
16,027 Recognized Expert Moderator MVP
I don't think you can use the splice method for the form elements array. It's for a normal array.

If you post the HTML, I'd have a better idea what you're trying to do. You may not even need this JavaScript code.
Jul 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3312
by: Gary N. | last post by:
Hi - I'm not sure if I've found a bug with the "splice" function or if I just need better documentation. Splice doesn't work quite how O'Reilly describes it (Javascript, 4th edition, Jan 2002,...
2
5196
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
2
2528
by: Mark P | last post by:
What should be the output of the following program? The SGI STL docs say that all iterators remain valid during a splice operation. The dinkumware library reference says that iterators to spliced...
6
4730
by: danmcleran | last post by:
Is there a good way to splice two lists together without resorting to a manual loop? Say I had 2 lists: l1 = l2 = And I want a list: as the result.
19
5379
by: Juha Nieminen | last post by:
If I'm not completely mistaken, the only reason why std::list::size() may be (and usually is) a linear-time operation is because they want std::list::splice() to be a constant-time operation, and...
1
2966
by: agendum97 | last post by:
MSDN says splice has the following arguments: arrayObj.splice(start, deleteCount, ]]]) Thus I can insert items into an array using splice. But how do I insert an entire array? For example:...
18
1810
by: dhtml | last post by:
Array.splice({}) What should it do? I think it should return a new Array with length 0. Array.splice(arr, start, deleteCount ]]) http://bclary.com/2004/11/07/#a-15.4.4.12 Example:
1
2014
by: magarwal | last post by:
Hi all, I am a newbie and trying to use splice function to read data from text file. It seems the data doesn't have line breaks but only separated by spaces. All I know is that each row has...
0
2197
by: Michael C | last post by:
"John Brock" <jbrock@panix.comwrote in message news:gg56ab$qsn$1@reader1.panix.com... You really need to stop trying to write perl code in dot net and VBA. Arrays are hard to resize for a good...
0
7225
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,...
0
7123
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...
0
7326
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,...
0
7383
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...
0
5627
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,...
1
5053
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...
0
4707
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...
0
1557
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.