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

Iframe Problem

I have an iframe within a jsp page which displays rows from a database. I
then have a checkbox where, when I check/uncheck the checkbox it performs
operations on the rows listed in the frame.

I get a jscript "undefined" error if 1 row is returned in the iframe. If I
have more that 1 then my length for the iframe shows the amount. if only 1
row is the iframe then my length comes up undefined
Jul 23 '05 #1
3 1559
Lans Redmond wrote:
I have an iframe within a jsp page which displays rows from a database. I then have a checkbox where, when I check/uncheck the checkbox it performs operations on the rows listed in the frame.

I get a jscript "undefined" error if 1 row is returned in the iframe. If I have more that 1 then my length for the iframe shows the amount. if only 1 row is the iframe then my length comes up undefined


Very difficult to recommend anything without knowing what you're doing.
Presumably a reference to 'the rows listed in the frame' is held in an
array, and no array is generated if there's only one row, so you can't
loop through it using the .length property. The fix is usually
something like:

obj = ('undefined' != typeof obj[0]) ? obj : [obj];

....where 'obj' is the (possible) array you're examining. Can't say more
without seeing more.

Jul 23 '05 #2
All i'm doing is , i have a table wicth can have multiple rows or none, or
even 1 depending on the search. I have this table in a jsp page. I then
have another jsp where I link to my table via an iframe.
Now for each row listed in the iframe i also build a checkbox. I use the
foloowing to check and Uncheck all checkboxes in the frame.

function verifyManualCheckUncheck()
{
if (document.frames[0].document.all.resendtriggerlist == null)
{
return;
}
if (checkFlag == false)
{
if (document.frames[0].document.all.resendtriggerlist.length > 0)
{
for (i = 0; i <
document.frames[0].document.all.resendtriggerlist.length; i++)
{
if (
document.frames[0].document.all.resendtriggerlist[i].checked == true )
{
resendData +=
document.frames[0].document.all.resendtriggerlist[i].value + ",";
deleteData +=
document.frames[0].document.all.resendtriggerlist[i].value + ",";
}
} //end for loop
}
}

}

now if one row is returned then this function fails. if i put an alert() to
get the length of the iframe then it ldisplays undefined

hope this is useful

"RobB" <fe******@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Lans Redmond wrote:
I have an iframe within a jsp page which displays rows from a

database. I
then have a checkbox where, when I check/uncheck the checkbox it

performs
operations on the rows listed in the frame.

I get a jscript "undefined" error if 1 row is returned in the

iframe. If I
have more that 1 then my length for the iframe shows the amount. if

only 1
row is the iframe then my length comes up undefined


Very difficult to recommend anything without knowing what you're doing.
Presumably a reference to 'the rows listed in the frame' is held in an
array, and no array is generated if there's only one row, so you can't
loop through it using the .length property. The fix is usually
something like:

obj = ('undefined' != typeof obj[0]) ? obj : [obj];

...where 'obj' is the (possible) array you're examining. Can't say more
without seeing more.

Jul 23 '05 #3
Lans, Rob already gave you the answer when he wrote "Presumably a
reference to 'the rows listed in the frame' is held in an array, and no
array is generated if there's only one row..." Read that carefully.
This hits all of us at times. You could do something like:

function verifyManualCheckUncheck()
{
var theList = document.frames[0].document.all.resendtriggerlist;

if (theList == null)
return;

// Check if only one e.g. not an array
if (typeof theList[0] == 'undefined')
{
resendData += theList.value + ",";
deleteData += theList.value + ",";
return;
}

if (checkFlag == false)
{
if (theList.length > 0)
{
for (i = 0; i < theList.length; i++)
{
if ( theList[i].checked == true )
{
resendData += theList[i].value + ",";
deleteData += theList[i].value + ",";
}
}
}
}
}

Jul 23 '05 #4

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

Similar topics

4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
12
by: wangzx | last post by:
I am the author of easyajax.sourceforge.net, and I have a problem on Firefox 1.5, I post the problem here and hopes somebody help me. The test page can be:...
26
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
1
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building...
7
by: nicknack | last post by:
Hi. I have a strange problem wuth IFRAME. I have page aaa.aspx with an IFRAME that contain page bbb.aspx. page bbb.aspx sometimes redirect him self to page ccc.aspx. The problem is that...
0
by: mem | last post by:
Hello, I'm a novice at this and am trying to solve a problem reference IFrame. The following code is for a page I've created. It works well with two exceptions. The IFrame is an application hosted...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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
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 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.