Solved

Javascript popup that populates two form textarea's

Posted on 2006-11-16
4
316 Views
Last Modified: 2006-11-18
Ok I have a popup window that populates one form field by clicking a link and right now it returns only one of the values Either <%=ors("id")%> or <%=ors("teamid")%>. but I do not know javascript so I was hoping that someone could help me figure out how to get this to populate two form text areas in one click on a form. Here is my script... courtesy of WMIF...  I need the value of <%=ors("id")%> to populate txtChain and I need <%=ors("teamid")%> to populate txtChain2

<script language="JavaScript" type="text/JavaScript">
function pickClose(selRte) {
      self.opener.document.form1.txtChain.value = selRte
    self.opener.focus()
    window.close()
}
</script>


here are my form fields

<input name="txtChain" id="txtChain" value="<%=playerid%>" type="text" size="20"><input type=button value="Find" onClick="javascript:popUp('./playersearch/inc_search.asp')"></td>
<input name="txtChain2" id="txtChain2" value="<%=teamid%>" type="text" size="20"><input type=button value="Find" onClick="javascript:popUp('./teamsearch/inc_search.asp')"></td>

here is the results of the search.....
0
Comment
Question by:jsuttor
  • 3
4 Comments
 
LVL 10

Expert Comment

by:dennis_maeder
ID: 17961356
Try this:

<script language="JavaScript" type="text/JavaScript">
function pickClose(selRte) {
    self.opener.document.form1.txtChain.value = selRte
    self.opener.document.form1.txtChain2.value = selRte
    self.opener.focus()
    window.close()
}
</script>
0
 
LVL 3

Author Comment

by:jsuttor
ID: 17961393
ok that makes the same value in both form textareas..... here is my link how do I have to setup the link to make it get seperate values....

<a href="javascript:pickClose(<%=ors("id")%>);"><%=ors("id")%></a>

I tried this and I get an error that selRte is not defined.
Link = <a href="javascript:pickClose(<%=ors("id")%>,<%=ors("teamid")%>);"><%=ors("id")%></a>

<script language="JavaScript" type="text/JavaScript">
function pickClose(selRte, selRte2) {
    self.opener.document.form1.txtChain.value = selRte
    self.opener.document.form1.txtChain2.value = selRte2
    self.opener.focus()
    window.close()
}
</script>


0
 
LVL 10

Accepted Solution

by:
dennis_maeder earned 500 total points
ID: 17961398
Taking a closer look, you want different values written - you must pass them in as separate arguments.
Assuming you have representations of
ors("id") and ors("teamid") you can pass them into the function so:

<script language="JavaScript" type="text/JavaScript">
function pickClose(id,teamid) {
    self.opener.document.form1.txtChain.value = id
    self.opener.document.form1.txtChain2.value = teamid
    self.opener.focus()
    window.close()
}
</script>
0
 
LVL 10

Expert Comment

by:dennis_maeder
ID: 17961420
leapfrog! - that looks like it should work - but ASP is not my forte.
D
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now