How to post a variable from search popup?

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   How to post a variable from search popup?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
I am making a form for my site and need little help with the js. I wasn't sure if this topic goes in javascript forum or phpnuke forum, so admin/mods please move it to appropriate forum.

I am using the file modules.php?name=Forums&file=search&mode=searchuser&popup=1 to open a popup and then search for a user (as done in buddylist and forum's admin area).

so far, I have made a form in which I have a few text boxes and I have added these "Find Username" buttons next to all the text boxes. The button opens the popup fine and am able to find the username, but my problem is.....how to send that selected username to the corresponding text box?


My code in php so far
echo"<form name=\"some_form\" action=\"final.php\" method=\"post\"><table>";

echo"<tr><td>username1</td><td><input type=\"text\" name=\"cat1\" class=\"post\" size=\"20\"><input type=\"submit\" name=\"usersubmit\" value=\"Find a username\" class=\"liteoption\" onClick=\"window.open('modules.php?name=Forums&file=search&mode=searchuser&popup=1', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;\" /></td></tr>";
echo"<tr><td>Username2</td><td><input type=\"text\" name=\"cat2\" size=\"20\"></td></tr>";
echo"<tr><td><input type=\"hidden\" name=\"uname\" value=\"$username\"><input type=\"submit\" value=\"Submit\"></td></tr>";



Thank You



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
You want to be able to select a name from another popup window and have it appear in a new popup window in a textarea? Or is it all in one popup?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
I am trying to put a button on a page which opens a popup for searching username and returns the username to the original page. It has been already implemented in nuke.

Example: (find username button)
[ Register or login to view links on this board. ]




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
<script language="javascript" type="text/javascript">
<!--
function refresh_username(selected_username)
{
   opener.document.forms['post'].username.value = selected_username;
   opener.focus();
   window.close();
}
//-->
</script>


Place that in the popup. And make the textarea's

<input type="text" name="username">


If you use more then one your going to have to change the themes/YOUR_THEME/forums/search_username.tpl and add the javascript again but rename the variables like so

<script language="javascript" type="text/javascript">
<!--
function refresh_username2(selected_username2)
{
   opener.document.forms['post'].username2.value = selected_username2;
   opener.focus();
   window.close();
}
//-->
</script>


<input type="text" name="username2">


Not tested but I dont see why it wouldnt work. Let me know.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum