Solved

Javascript popup that populates two form textarea's

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

762 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

17 Experts available now in Live!

Get 1:1 Help Now