Help please.
I am trying to autofill a form text field from a select-box lookup.
I have no problem doing this if the select-box is part of the form
but because there are 5 possible select boxes for them to choose
from and because of the very large number of options in each
select box, to save form loading time, I want to put the look-up
select boxes on separate (pop-up) pages. (I prefer them not to
be hidden divs on the same page)
Here is the code I have so far:
THE FORM
<FORM NAME="ListingForm" action="path-to-sendmail.cgi" method="post"
onsubmit="CheckForm()">
<input type="text" size="60" name="showValue" style="FONT-SIZE: 8pt; HEIGHT:
12pt">
LOOKUP OPTIONS (Links within the form)
<A HREF= "#" onClick="window.open('Lookup/honours.html','Sample',
'toolbar=no,width=520,height=550,left=10,top=10, status=no,scrollbars=no,
resize=no');return false"><font style=FONT-SIZE:8pt>HONOURS & AWARDS</A>
<A HREF= "#" onClick="window.open('Lookup/decorations.html','Sample',
'toolbar=no,width=520,height=550,left=10,top=10, status=no,scrollbars=no,
resize=no');return false"><font style=FONT-SIZE:8pt>DECORATIONS</A>
(There are three more options)
etc etc submit etc </form>
ONE OF THE POP-UP'S - Lookup/honours.html
<select name="Honours"
onchange="document.ListingForm.showValue.value=this.value">
<option value="">Please select an option</option>
<option value="Medal Name 1">Medal Name 1</option>
<option value="Medal Name 2">Medal Name 2</option>
<option value="Medal Name 3">Medal Name 3</option>
<option value="Medal Name 4">Medal Name 4</option></select>
As stated. When the "select box resides in the form, the
text box - 'showValue' populates correctly but it will not do so from
the popped-up page. How can I link the five lookup pages to the form
please???
All help gratefully received
shimmyshack - 30 Apr 2007 01:14 GMT
> Help please.
> I am trying to autofill a form text field from a select-box lookup.
[quoted text clipped - 51 lines]
>
> All help gratefully received
you have to tell the popped up window which page opened it, then send
the data there.
so in the pop up
function setvalue(formname,inputname)
{
var mainpage = window.opener;
//now set value of which select you need
mainpage.formname.inputname......
}
so when user clicks the drop down in the pop up, send tha selected
value to the function which sends it on to the input within the form
in the opener
shimmyshack - 30 Apr 2007 16:05 GMT
> > Help please.
> > I am trying to autofill a form text field from a select-box lookup.
[quoted text clipped - 67 lines]
> value to the function which sends it on to the input within the form
> in the opener
further info in post " Cannot get child to feed the parent!" 30th april