Javascript technique to retrieve checked values...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
rlogin
Forum Newbie
Posts: 19
Joined: Fri Oct 18, 2002 2:39 am

Javascript technique to retrieve checked values...

Post by rlogin »

Hi all,
I wanted some help on this scenario...
I have a main browser window. On clicking a hyperlink, i popup a new window. The pop up window has several check boxes and a submit buton.
The user is expected to check some of the boxes and submit.
These checked values need to be populated in a text box in the main window and the popup should close down.

Iam not able to get the checked values in the popup window into the main window check box.

Can somebody gimme some rough code or an approach to get over this...
Rgds
gOloVasTicK
Forum Newbie
Posts: 2
Joined: Thu Oct 31, 2002 6:57 am
Location: Russia, Peterburg
Contact:

Post by gOloVasTicK »

Try this:

In main window:
<a href=your_popup.html target=_blank>ypur_link</a>
<form name=frm>
<input type=text name=txt>
</form>

In popup window:
<form name=popupf>
<input type=checkbox name=chbx1 value=1>
<input type=checkbox name=chbx2 value=2>
<input type=checkbox name=chbx3 value=3>
<input type=button value=submit onClick='for(i=1;i<4;i++){if(eval("popupf.chbx"+i+".checked")){opener.document.frm.txt.value+=eval("popupf.chbx"+i+".value")+";"}};window.close();'>
</form>

Rgdz
gOloVasTicK
Forum Newbie
Posts: 2
Joined: Thu Oct 31, 2002 6:57 am
Location: Russia, Peterburg
Contact:

Post by gOloVasTicK »

If you want get checkboxes values in main window checkbox:

In main window:
<a href=your_popup.html target=_blank>your_link</a>
<form name=frm>
<input type=checkbox name=chbx1>
<input type=checkbox name=chbx2>
<input type=checkbox name=chbx3>
</form>

In popup window:
<form name=popupf>
<input type=checkbox name=chbx1 value=1>
<input type=checkbox name=chbx2 value=2>
<input type=checkbox name=chbx3 value=3>
<input type=button value=submit onClick='for(i=1;i<4;i++){eval("opener.document.frm.chbx"+i+".value=popupf.chbx"+i+".value")}};window.close();'>
</form>

Rgdz
Post Reply