multiple variable 'onclick' event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ddtpmyra
    Contributor
    • Jun 2008
    • 333

    multiple variable 'onclick' event

    How can I assigned multiple varialble from my result query?
    example of my code is

    Parent Form:
    Code:
    	<input type=\"text\" name=\"contactid\"  
    	if $contact !='NULL' 
    	then value=\"$contact\" 
    	else value=\"1\" onclick=\"window.open('contact_search.php')\"></input>";
    child Form #1:
    Code:
    <form action="contact_search_sub.php" method="post" name="contact_search_sub">
    child Form #2:
    Code:
     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
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You could use window.opener to refer to the parent and then use something like:
    Code:
    window.opener.document.getElementById("contactid").value = contactid;
    and likewise for any more results.

    Comment

    • ddtpmyra
      Contributor
      • Jun 2008
      • 333

      #3
      Originally posted by acoder
      You could use window.opener to refer to the parent and then use something like:
      Code:
      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?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Similar, but just change the ID of the element when using document.getEle mentById to get access to it.

        Comment

        Working...