Solved

Javascript popup that populates two form textarea's

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 20
How to make a moving character 3 58
asp.net mvc5 6 17
Add shadow behind div 5 14
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

810 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