Solved

Javascript popup that populates two form textarea's

Posted on 2006-11-16
4
319 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 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

739 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