Click to See Complete Forum and Search --> : Fetch selected value from a new window???


shanuragu
10-29-2003, 02:07 AM
HI

I have a from (say form1) with a text field & a button next to it.

When I click the button a new window will be opened displaying some values with table columns.

My problem is when I select/click a table column in the new window the corresponding value should be carried on to the form1 text filed & the text field value(if any) should be replaced with this value. Finally the new window should be closed automatically??

Here I am able to open a new window, but I am unable to get the selected column value in to the form1 text field.

How can I do this??

shara

pelegk1
10-29-2003, 02:36 AM
say the selct is this :
<select id=sel1 onChange="update()">
<option>1</option>
<option>2</option>
<option>3</option>
</select>

<script>
function update(){

//say the text field in windiw 1 id="text1"
window.opener.text1.value=sel1.options[sel1.selectedindex].value;
//or if u want the selected tet and not the value then :
window.opener.text1.value=sel1.options[sel1.selectedindex].innerText;

}
</script>

shanuragu
10-29-2003, 04:51 AM
No improvement.
Here is the code

function GetColorCode(cc)
{
var ccode = cc
window.opener.bg_color.value=cc;
}


<%
For i = 0 to l
%>
<td><input type="submit" name="color" value="<%=colorName(i)%>" style="background-color='<%=colorArr(i)%>';border-style:none;" onclick="document.form.ccode.value='<%=colorArr(i)%>';javascript:GetColorCode('<%=colorArr(i)%>');top.window.close();"></td>
<%
Next
%>

Here I am displaying color pallette in the new window & the selected color code should be displyed on to the parent window text box and also the new window should get closed automatically after the selection.

Please help


shara

:confused:

shanuragu
10-29-2003, 05:33 AM
Thanks pelegk1

ur suggestions did help me to solve my problem. It is working fine now.

I am passing the selected value as follows..

function GetColorCode(cc)
{
var ccode = cc;
window.opener.<%=form_name%>.<%=field_name%>.value=ccode;
}

here can I set the background color of the same text box with the selected color code with in the same function???
if so, how can I do it??
I am very bad in using style sheet properties. please help

shara