...

View Full Version : Pass variable



ramli
06-18-2007, 07:42 PM
Hellow,

I want to send a varable from a pop-up window to a form input value.

If tried this (its within php)
<a href='#' onclick=\"parent.membersadd.location.value = '$city'\">add</a>

membersadd is the name of the form and location the name of the inputbox

But it doesnt work if u know were i went wrong pleace help me.

smalldog
06-18-2007, 07:51 PM
Try



window.opener.membersadd.location.value = ''

ramli
06-18-2007, 08:22 PM
No that doesnt work. remember im trying to send from a popup window.

smalldog
06-18-2007, 08:51 PM
Sets or retrieves a reference to the window that created the current window.

http://msdn2.microsoft.com/en-us/library/ms534309.aspx

That means, you have a bug somewhere in your code either wrong manipulation with php or with DOM.

glenngv
06-18-2007, 09:08 PM
function setLocation(city){
if (opener && !opener.closed){
opener.document.membersadd.location.value = city;
opener.focus();
}
window.close();
return false;
}
echo "<a href=\"#\" onclick=\"return setLocation('$city');\">add</a>" //syntax may be wrong as I don't know PHP;
Remove focus() and close() statements if the popup is not supposed to close if the Add link is clicked.

ramli
06-18-2007, 11:06 PM
Thanx that is exacly what i needed :thumbsup: :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum