reciving variables from a select

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

reciving variables from a select

Post by pelegk2 »

i have this form :

Code: Select all

<FORM id=frmCloseWeight1 name=frmCloseWeight1 method=post> 
<TD><SELECT onchange="wait4Approve('frmCloseWeight1');" name=endStatus><OPTION value=1 selected>&#1492;&#1513;&#1511;&#1497;&#1500;&#1492; &#1492;&#1505;&#1514;&#1497;&#1497;&#1502;&#1492;?</OPTION><OPTION value=2>&#1505;&#1490;&#1493;&#1512;</OPTION></SELECT> </TD></FORM> 
<TD>&nbsp;</TD></TR>


what i do is this :
the changes his selection on the select box!
and then in the function wait4Approve() i amopning a window that asks for user name and password.
when i enter a valid user name and password a function that called :
approved() is being called from the open window,
and in this function i submit the above code :

Code: Select all

document.getElementById(valFrmCloseWeight).submit();

the thing is that in the QUERY_STRING of the server variables i see
not the selected in dex but the user name and password of the opened window!!!?!?!?!?!?
what is that?
what to do?
thnaks in advance
peleg
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

WARNING: Guessing and Assuming in Progress!

It sounds like your submitting the popup window when what you want to do is submit both the parent window and subwindow. If that so you need to either pass the select to the popup or pass username and pass to the parent window. All the data has to be in one window on submit.

Here's an example of what I do to pass data back to parent. This example comes from a bbcode wrapper, it pops up a window so a smiley can be insert in a textarea.

Code: Select all

// code from parent window
var smiley_win = null; 

function close_subwindows() &#123;
	if (smiley_win != null && smiley_win.open) smiley_win.close();
&#125; 

// el = textarea
// lft = bbcode to insert
function smiley_dialog(el) &#123;
	smiley_dialog._return = function(lft) &#123;
		insert_tag( el, lft );
	&#125;
	smiley_win = window.open(editor_path +'smiley.php', 'smiley',
		'width=300,height=300,toolbar=no,menubar=no,' 
		+ 'personalbar=no,scrollbars=no,resizable=yes');
	window.onunload = function() &#123; close_subwindows(); &#125;
&#125;

Code: Select all

// code from subwindow
function insert_smiley(lft) &#123;
	
	if ( window.opener && !window.opener.closed )&#123;
		if( !lft ) return;
		lft = '&#1111;img]' + lft + '&#1111;/img]';
		window.opener.smiley_dialog._return(lft);
	&#125;
	window.close();
&#125;
Maybe you'll get an idea from that?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Moved to Client Side
Post Reply