Hi !
Thanks for the help
i tired this and it wokred
<script language="JavaScript">
<!--
function setForm() {
for (var i=0;i < document.form2.catID.length;i++) {
if (document.form2.catID[i].checked == true){
var ci =document.form2.catID[i].value ;
var cid2 = ci.split("|*|*|");
for ( var j=0 ; j < cid2.length ; j++){
if ( j==0 )
opener.document.form1.cid.value = cid2[j];
if ( j==1 )
opener.document.form1.choose_category_name.value = cid2[j];
}
//return (cid2);
}
}
// opener.document.outputForm1.outputField2.value
document.inputForm1.inputField2.value;
// document.close();
foo();
return false
}
function foo() { close();}
//-->
</script>
<table width="100%">
<% k=0%><%
startrw = 0
endrw = HLooper1__index
numberColumns = 3
numrows = -1
while((numrows <> 0) AND (Not Recordset1.EOF))
startrw = endrw + 1
endrw = endrw + numberColumns
%>
<tr align="center" valign="top">
<%
While ((startrw <= endrw) AND (Not Recordset1.EOF))
%>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2"
bgcolor="#B5CCE6">
<tr>
<td class="ST">
<%cn=(Recordset1.Fields.Item("Catagory").Value)%>
<%cid=(Recordset1.Fields.Item("ID").Value)&"|*|*|"&cn%>
<input type="radio" name="catID" value="<%=cid%>">
<%=cn%>
</td>
</tr>
</table>
</td>
<% k=k+1%> <%
startrw = startrw + 1
Recordset1.MoveNext()
Wend
%>
</tr>
<%
numrows=numrows-1
Wend
%>
</table>
Thanks majid &chad.peck
Suhailkaleem
----- Original Message -----
From: <Chad.Peck@a...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Tuesday, March 11, 2003 1:08 PM
Subject: [javascript_howto] Re: undeifned in the parent window text fiild
> The problem is with the following statement:
>
> document.form2.cid+i.value
>
> Are you attempting to add document.form2.cid to i.value? This is what
> javascript thinks, because cid+i isn't a valid name for a form element.
> Since document.form2.cid is an object and i.value would give an empty
> string, you get NaN as a result. I'm assuming you want to use something
> like this:
>
> document.form2.elements["cid" + i].value
>
> > hi
> Thanks it is working now but look at this and tell me
>
> i have only pasted the JS code and Asp loop code
>
>
> i am trying to pass multiple values to parnet window like ID , name and
> other values but i get NaN in text feild why is that wat i am doing
> wrong
> ?
>
>
>
>
>
>
> <script language="JavaScript">
> <!--
> function setForm() {
>
> for (var i=0;i < document.form2.catID.length;i++) {
> if (document.form2.catID[i].checked == true)
> opener.document.form1.cid.value = document.form2.cid+i.value;
> opener.document.form1.choose_category_name.value
> document.form2.cid+i.value;
>
> }
>
> // I DONT GET ANY ERROR BUT IN PARENT WINDOW TEXT FEIDL I GET NaN
> // wat is NaN AND WHY DONT I GET THE VALUES WAT I AM DOING WRONG
>
> //self.close();
> return false;
> }
>
> //-->
> </script>
>
>
>
>
> <table width="100%">
> <% k=0%><%
> startrw = 0
> endrw = HLooper1__index
> numberColumns = 3
> numrows = -1
> while((numrows <> 0) AND (Not Recordset1.EOF))
> startrw = endrw + 1
> endrw = endrw + numberColumns
> %>
>
> <tr align="center" valign="top">
> <%
> While ((startrw <= endrw) AND (Not Recordset1.EOF))
> %>
> <td>
> <table width="100%" border="0" cellspacing="0"
> cellpadding="2"
> bgcolor="#B5CCE6">
> <tr>
> <td class="ST">
> <input type="radio" name="catID"
> value="<%cid=(Recordset1.Fields.Item("ID").Value)%><%=cid%>">
> <input type="hidden" name="cid<%=k%>" value="<%=cid%>">
> <%cn=(Recordset1.Fields.Item("Catagory").Value)%><%
> =cn%>
> <input type="hidden" name="cn<%=k%>" value="<%=cn%>">
> </td>
> </tr>
> </table>
> </td>
> <% k=k+1%> <%
> startrw = startrw + 1
> Recordset1.MoveNext()
> Wend
> %>
> </tr>
> <%
> numrows=numrows-1
> Wend
> %>
> </table>
>
>
>
> Thanks
> Suhailkaleem
>
>
>
> ----- Original Message -----
> From: "Abdul Majid Qazi" <majid@i...>
> To: "JavaScript HowTo" <javascript_howto@p...>
> Sent: Monday, March 10, 2003 2:37 AM
> Subject: [javascript_howto] Re: undeifned in the parent window text fiild
>
>
> > Some of the issues that I found and fixed to run this script on my
> machine:
> >
> > 1. The array of radio buttons will be created only if there are
> more
> than one radio buttons with the same name i.e. if you will display one
> item
> with one radio button in the form, the javascript code to loop through the
> array of radio buttons would not work. Change your SQL statement to select
> more than one records to test this script.
> >
> > 2. As I suggested in one of my previous posts, the condition for the
> if
> statement should be whether the radio button is checked or not. But you'r
> still evaluating for true and false value. Change the JavaScript loop as
> follows:
> >
> > for (var i=0;i < document.form2.catid.length;i++) {
> > if (document.form2.catid[i].checked == true)
> > opener.document.form1.choose_category_name.value
> document.form2.catid[i].value;
> > }
> >
> > 3. In the ASP code where you are creating the radio buttons, you'r
> using field name as "ID" whereas your SQL statement shows that the field
> name should be (presumably) "industryID". As a result the value of the
> radio button is null.
> >
> > 4. Change that part of the code with the following:
> >
> > <table width="100%" border="0" cellspacing="0" cellpadding="2"
> bgcolor="#B5CCE6">
> > <tr>
> > <td class="ST">
> > <input type="radio" name="catid"
> value="<%cid=(Recordset1("industryID"))%><%=cid%>">
> > <input type="hidden" name="cid"
> value="<%=cid%>"><%cn=Recordset1("industryName")%><%=cn%>
> > <%=(Recordset1.Fields.Item("industryID").Value)%>
> > </td>
> > </tr>
> > </table>
> >
> >
> >
> > ----- Original Message -----
> > From: "suhailkaleem" <suhailkaleem@p...>
> > To: "JavaScript HowTo" <javascript_howto@p...>
> > Sent: Sunday, March 09, 2003 1:11 PM
> > Subject: [javascript_howto] Re: undeifned in the parent window text
> fiild
> >
> >
> > > HI !
> > > i still can't make it work
> > > here is the code please help
> > >
> > >
> > >
> > > <%@LANGUAGE="VBSCRIPT"%>
> > >
> > > <!--#include file="../Connections/ex.asp" -->
> > >
> > > <%
> > >
> > > Dim Recordset1__MMColParam
> > >
> > > Recordset1__MMColParam = "1"
> > >
> > > if (Request.Form("ID") <> "") then Recordset1__MMColParam
> > > Request.Form("ID")
> > >
> > > %>
> > >
> > > <%
> > >
> > > set Recordset1 = Server.CreateObject("ADODB.Recordset")
> > >
> > > Recordset1.ActiveConnection = MM_ex_STRING
> > >
> > > Recordset1.Source = "SELECT * FROM catagory WHERE industryID = '" +
> > > Replace(Recordset1__MMColParam, "'", "''") + "'"
> > >
> > > Recordset1.CursorType = 0
> > >
> > > Recordset1.CursorLocation = 2
> > >
> > > Recordset1.LockType = 3
> > >
> > > Recordset1.Open()
> > >
> > > Recordset1_numRows = 0
> > >
> > > %>
> > >
> > > <%
> > >
> > > Dim HLooper1__numRows
> > >
> > > HLooper1__numRows = -3
> > >
> > > Dim HLooper1__index
> > >
> > > HLooper1__index = 0
> > >
> > > Recordset1_numRows = Recordset1_numRows + HLooper1__numRows
> > >
> > > %>
> > >
> > > <html>
> > >
> > > <head>
> > >
> > > <title>Untitled Document</title>
> > >
> > > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
> 1">
> > >
> > > <link rel="stylesheet" href="../master.css" type="text/css">
> > >
> > > <script language="JavaScript">
> > >
> > > <!--
> > >
> > > function setForm() {
> > >
> > >
> > >
> > > for (var i=0;i<4;i++) {
> > >
> > >
> > > if (document.form2.catID[i].value == true)
> > > opener.document.form1.choose_category_name.value
> > > document.form2.catID[i].value;
> > >
> > >
> > >
> > >
> > > }
> > >
> > >
> > >
> > > //self.close();
> > >
> > > return false;
> > >
> > > }
> > >
> > > //-->
> > >
> > > </script>
> > >
> > > </head>
> > >
> > > <body bgcolor="#FFFFFF" text="#000000" >
> > >
> > > <form name="form2" method="post" >
> > >
> > > <table width="98%" border="0" cellspacing="2" cellpadding="2"
> > > align="center">
> > >
> > > <tr>
> > >
> > > <td class="heading" bgcolor="#244893"><font color="#FFFFFF">Select a
> > > Catagory</font></td>
> > >
> > > </tr>
> > >
> > > <tr>
> > >
> > > <td>
> > >
> > > <table width="100%">
> > >
> > > <%
> > >
> > > startrw = 0
> > >
> > > endrw = HLooper1__index
> > >
> > > numberColumns = 3
> > >
> > > numrows = -1
> > >
> > > while((numrows <> 0) AND (Not Recordset1.EOF))
> > >
> > > startrw = endrw + 1
> > >
> > > endrw = endrw + numberColumns
> > >
> > > %>
> > >
> > > <tr align="center" valign="top">
> > >
> > > <%
> > >
> > > While ((startrw <= endrw) AND (Not Recordset1.EOF))
> > >
> > > %>
> > >
> > > <td>
> > >
> > > <table width="100%" border="0" cellspacing="0" cellpadding="2"
> > > bgcolor="#B5CCE6">
> > >
> > > <tr>
> > >
> > > <td class="ST">
> > >
> > > <input type="radio" name="catID"
> > > value="<%cid=(Recordset1.Fields.Item("ID").Value)%><%=cid%>">
> > >
> > > <input type="hidden" name="cid" value="<%=cid%>">
> > >
> > > <%cn=(Recordset1.Fields.Item("Catagory").Value)%><%=cn%>
> > > <%=(Recordset1.Fields.Item("ID").Value)%></td>
> > >
> > > </tr>
> > >
> > > </table>
> > >
> > > </td>
> > >
> > > <%
> > >
> > > startrw = startrw + 1
> > >
> > > Recordset1.MoveNext()
> > >
> > > Wend
> > >
> > > %>
> > >
> > > </tr>
> > >
> > > <%
> > >
> > > numrows=numrows-1
> > >
> > > Wend
> > >
> > > %>
> > >
> > > </table>
> > >
> > > </td>
> > >
> > > </tr>
> > >
> > > <tr>
> > >
> > > <td bgcolor="#244893">
> > >
> > > <div align="center">
> > >
> > > <input type="button" name="Button" value="Submit" class="BTN"
> > > onClick="return setForm();">
> > >
> > > </div>
> > >
> > > </td>
> > >
> > > </tr>
> > >
> > > </table>
> > >
> > > </form>
> > >
> > > </body>
> > >
> > > </html>
> > >
> > > <%
> > >
> > > Recordset1.Close()
> > >
> > > %>
> > >
> > >
> > >
> > > Thanks
> > >
> > > ----- Original Message -----
> > > From: "Majid" <majid@i...>
> > > To: "JavaScript HowTo" <javascript_howto@p...>
> > > Sent: Saturday, March 01, 2003 3:04 AM
> > > Subject: [javascript_howto] Re: undeifned in the parent window text
> fiild
> > >
> > >
> > > > In the following line replace checked with value:
> > > >
> > > > opener.document.form1.choose_category_name.value
> > > > document.form2.catID[i].checked ;
> > > >
> > > > This line should look like:
> > > >
> > > > opener.document.form1.choose_category_name.value
> > > > document.form2.catID[i].value;
> > > >
> > > >
> > > > Majid
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "suhailkaleem" <suhailkaleem@p...>
> > > > To: "JavaScript HowTo" <javascript_howto@p...>
> > > > Sent: Friday, February 28, 2003 1:52 PM
> > > > Subject: [javascript_howto] Re: undeifned in the parent window text
> fiild
> > > >
> > > >
> > > > > i still get true or flase in the text feild
> > > > > please help
> > > > >
> > > > > Suhailkaleem
> > > > > ----- Original Message -----
> > > > > From: "Abdul Majid Qazi" <majid@i...>
> > > > > To: "JavaScript HowTo" <javascript_howto@p...>
> > > > > Sent: Friday, February 28, 2003 11:06 AM
> > > > > Subject: [javascript_howto] Re: undeifned in the parent window
> text
> > > fiild
> > > > >
> > > > >
> > > > > > Remove quotes from the document.form2.CatID... It should be like
> this:
> > > > > >
> > > > > > if (eval(document.form2.catID[i].checked) == true)
> > > > > >
> > > > > > Majid
> > > > > >
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "suhailkaleem" <suhailkaleem@p...>
> > > > > > To: "JavaScript HowTo" <javascript_howto@p...>
> > > > > > Sent: Thursday, February 27, 2003 12:30 PM
> > > > > > Subject: [javascript_howto] undeifned in the parent window text
> fiild
> > > > > >
> > > > > >
> > > > > > > hi !
> > > > > > > i always get a undeifned in the parent window text fiild
> when i
> try
> > > > > this
> > > > > > > code in child window
> > > > > > >
> > > > > > > opener.document.form1.choose_category_name.value
> > > > > > > document.form2.catID.checked;
> > > > > > >
> > > > > > > form name and field name are correct
> > > > > > >
> > > > > > > ok now on my asp page i have loop that will display products
> and
> > > every
> > > > > > > product have radio button with it the value of radio button
> is
> set
> > > to
> > > > > the
> > > > > > > id of product i want to pass the selcted radio button value
> to
> > > parent
> > > > > > > window i tired this but it only gives me true or flase in the
> parent
> > > > > > window
> > > > > > > text feild-
> > > > > > >
> > > > > > > i want the selected radio id passed to the hidden feild and
> name of
> > > > the
> > > > > > > product pass to the text feild in parent window .
> > > > > > >
> > > > > > > for (var i=0;i<101;i++) {
> > > > > > > if (eval("document.form2.catID["+ i +"].checked") ==
> true)
> > > > > > > opener.document.form1.choose_category_name.value
> > > > > > > document.form2.catID[i].checked;
> > > > > > >
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > >
> > > > > > > Thanks
> > > > > > > Suhail kaleem
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
>