Connecting Tech Pros Worldwide Forums | Help | Site Map

multiple variable 'onclick' event

ddtpmyra's Avatar
Familiar Sight
 
Join Date: Jun 2008
Location: CA
Posts: 222
#1: Sep 8 '09
How can I assigned multiple varialble from my result query?
example of my code is

Parent Form:
Expand|Select|Wrap|Line Numbers
  1.     <input type=\"text\" name=\"contactid\"  
  2.     if $contact !='NULL' 
  3.     then value=\"$contact\" 
  4.     else value=\"1\" onclick=\"window.open('contact_search.php')\"></input>";
child Form #1:
Expand|Select|Wrap|Line Numbers
  1. <form action="contact_search_sub.php" method="post" name="contact_search_sub">
child Form #2:
Expand|Select|Wrap|Line Numbers
  1.  echo "<td><input type='button' value='select' onclick=\"contactid('". $row['contactid']. "')\" >"; 
how can i assigned more than one query result back to my original page? For instance, the name and contact id?

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Sep 9 '09

re: multiple variable 'onclick' event


You could use window.opener to refer to the parent and then use something like:
Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById("contactid").value = contactid;
and likewise for any more results.
ddtpmyra's Avatar
Familiar Sight
 
Join Date: Jun 2008
Location: CA
Posts: 222
#3: Sep 10 '09

re: multiple variable 'onclick' event


Quote:

Originally Posted by acoder View Post

You could use window.opener to refer to the parent and then use something like:

Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById("contactid").value = contactid;
and likewise for any more results.

what if i wanted contactname field but will populate from different text box. how can i do that?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Sep 10 '09

re: multiple variable 'onclick' event


Similar, but just change the ID of the element when using document.getElementById to get access to it.
Reply