Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grrr Asp/Javascript problem

Status
Not open for further replies.

dancinOTG

Technical User
Aug 28, 2002
19
CA
Can you pass an AutoNumber Id from a database table made with asp to another page using javascript?

I have one page Form.asp on this page i have a javascript function that opens a window with Table.asp. This is a database table of images from a database. (this whole part works perfectly)

Now on Table.asp i have a form and a javascript function that when a user clicks on the button beside the text box which has the AutoNumber Id in it, its suppose to send that number to the text box on the parent(Form.asp) page.

all it is doing is sending null value?

this is the script to send the value

<script language=javascript>
function setParent(){
window.opener.document.theForm.IconId.value =
document.myForm.thisBox(&quot;IconId&quot;);
}
</script>


this is the asp for the table
<%
fp_sQry=&quot;SELECT * FROM ICON&quot;
fp_sDefault=&quot;&quot;
fp_sNoRecords=&quot;<tr><td colspan=2 align=left width=&quot;&quot;100%&quot;&quot;>No records returned.</td></tr>&quot;
fp_sDataConn=&quot;Database1&quot;
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=&quot;&quot;
fp_sMenuValue=&quot;&quot;
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file=&quot;../_fpclass/fpdbrgn1.inc&quot;-->
<!--webbot bot=&quot;DatabaseRegionStart&quot; i-CheckSum=&quot;19434&quot; endspan -->

<tr>
<td><input type=&quot;text&quot; size=&quot;5&quot; name=thisBox value='<%=FP_FieldVal(fp_rs,&quot;IconID&quot;)%>'><input type=&quot;submit&quot; value=&quot;Button&quot; name=&quot;B1&quot; onClick=&quot;setParent();&quot;></td>
<td><img border=&quot;0&quot; src=&quot;<%=FP_FieldLink(fp_rs,&quot;Icon&quot;)%>&quot;></td>
</tr>
<!--webbot bot=&quot;DatabaseRegionEnd&quot; startspan b-tableformat=&quot;TRUE&quot;
b-menuformat=&quot;FALSE&quot; u-dbrgn2=&quot;../_fpclass/fpdbrgn2.inc&quot; i-groupsize=&quot;0&quot;
clientside tag=&quot;TBODY&quot;
local_preview=&quot;<tr><td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;><font color=&quot;#000000&quot;>This is the end of a Database Results region.</font></td></tr>&quot;
preview=&quot;<tr><td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;><font color=&quot;#000000&quot;>This is the end of a Database Results region.</font></td></tr>&quot; --><!--#include file=&quot;../_fpclass/fpdbrgn2.inc&quot;-->
<!--webbot bot=&quot;DatabaseRegionEnd&quot; i-CheckSum=&quot;56926&quot; endspan -->

</tbody>
</table>
<p> </p>

</form>


can anyone help?
 
Hi DancinOTG,

Try replacing:

window.opener.document.theForm.IconId.value =
document.myForm.thisBox(&quot;IconId&quot;);

with:

window.opener.document.theForm.IconId.value =
document.myForm.thisBox.value;

Cheers,

Gorkem.
 
ty 4 quick response

That just changes the error from null... to undefined

danc
 
I see.. the problem is the fact that you do not have an open <FORM> tag.

put this before the first form element:

<FORM NAME=&quot;myForm&quot; ACTION=&quot;javascript: void();&quot;>


This should solve your UNDEFINED error.

Cheers,

Gorkem.
 
ty 4 tryin to help but that still gives me a value of undefined

danc
 
[tt]
Why don't you pass the AutoNumber ID in the url from one page to another by simply using a recordset ?

i.e.
Page 1
Field 1?id=<%RS(&quot;AutoNumberID&quot;)%>

Page 2
Request * from table where ID = QueryString(&quot;id&quot;)

[ul][li]What do all these errors in ASP really mean? .... [/li] [li]What are the many ways to send emails with ASP? .... [/li][li]Where can I learn ASP? .... [/li][/ul]

 
ty
but to do it that way the user would have to open table.asp first not the form page and yes it does work that way.

However I am being obstinant and want them to open registration page first and then, only if they want an image beside their name, they click the open images button and choose one.

It seems though that maybe my only option here because i've tried everything :(

danc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top