?
Solved

Javascript popup that populates two form textarea's

Posted on 2006-11-16
4
Medium Priority
?
323 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
Suggested Courses

765 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