Re: Cannot get child to feed the parent!



On Apr 30, 11:20 am, "Richard" <s...@xxxxxxxxxxxxxx> wrote:
Greetings.
I am total newbie to Javascript so what is written below is
probably a bunch of cobblers!! Any assistance in correcting
my code much appreciated.

I wish the popped up child to pass value from the select box
to a text box on the parent form.

Here are my pages (in part)

parent.html

<html><head><title>Parent Page</title></head><body>

<FORM NAME="ListingForm">
Use Lookup <input type="text" size="60" name="showValue">
<br>
<A HREF= "#" onClick="window.open('child1.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>TABLE LOOKUP</A>
</form></body></html>

child1.html

<html><head><title>Child1</title>
<SCRIPT LANGUAGE="Javascript" TYPE="text/Javascript">

function setvalue(ListingForm,showValue)

{

var mainpage = window.opener;

parent.ListingForm.showValue

}

</script></head>

<form>

<select name="Options"
onchange="document.ListingForm.showValue.value=this.value">

<option value="">Please select an option</option>

<option value="first option">first option</option>

<option value="second option">second option</option>

<option value="third option">third option</option>

<option value="forth option">fourth option</option>

</select></form>

I have no problem populating the text field on the form if the lookup

table is also part of the same form - but that is not what I need to
achieve.

you should have carried on with the thread " Help please with form
field population from a 2nd page" really.

child1.html ------------------8<------------
<html>
<head>
<title>Child1</title>
<script type="text/javascript">

function setvalue(selectvalue)
{

var t = window.opener;
var sender = ( !t || t.closed ) ? alert('parent window was closed') :
t;
sender.document.ListingForm.showValue.value = selectvalue;

}
</script>
</head>
<body>
<form>
<select name="Options" onchange="setvalue(this.value)">
<option value="">Please select an option</option>
<option value="first option">first option</option>
<option value="second option">second option</option>
<option value="third option">third option</option>
<option value="forth option">fourth option</option>
</select>
</form>
</body>
</html>
-------------------8<-----------

parent.html-----------------8<----------------
<html>
<head>
<title>Parent Page</title>
</head>
<body>

<form name="ListingForm">
Use Lookup
<input type="text" size="60" name="showValue">
<br>
<A HREF= "#" onClick="var
win=window.open('child1.html','Sample','toolbar=no,width=520,height=550,left=10,top=10,
status=no,scrollbars=no,resize=no');return false">TABLE LOOKUP</A>
</form>
</body>
</html>

try to understnad whats been posted, dont just copy and paste and
leave it at that, what if the pop up appears below the current window?
what if the parent closes and the pop up is left orphaned, how about
focusing back to the parent and closing the pop up when a select is
made, or how about focusing back to the parent but setting the url of
the child to the next select, so it loads in the background and can
just be focused. by using a non standrd way of filling out a simple
form, you are creating usability hurdles for you and your users -
which you can only solve using a scripting language which itself
reduces the audience and legality - unless you provided a straight
forward alternative for those who need it.

by the way, your code is pretty sloppy, copy and paste job mixed with
bad markup, whats the action of the form, what method, why use a popup
to do this when it isnt accessible, the time for 20 selects each with
100 options is negligible compared to an image, so compress your
images properly, and dont overload the form page, and just use a
standard appraoch - like everyone else. Dont try to be the one with
the cunning new method - even its a great method your clients will
still be confused that you do it differently, if they can even access
the pop up - which are mostly blocked these days and are bad practise
anyway.

.



Relevant Pages

  • Re: forced vibration question
    ... >> the springs wwere just an example to show you how complicated ... so dont drag me to courth if i am not acurate... ... the distance between parent nad th vertical point ... and btw i cant demand you to stop answering ...
    (sci.physics)
  • Re: Dad feeling guilty
    ... Yeah, what jennifer said. ... When you become a parent, ... If you dont want to put the time and make that decission to do so, then, I ...
    (misc.kids)
  • Re: Coping with multiple roots in a tree widget?
    ... Words to the wise, Tim M wrote: ... This is more general, but if you dont have a parent, then you do not ... have a real tree, so perhaps it is the wrong widget? ...
    (comp.lang.smalltalk.dolphin)
  • Re: Converting Tree Structure from Vector
    ... One thing I dont know how to do "doing the ... >obvious things to hook up parents and children". ... If you have a parent field in a child you must put a reference to the ...
    (comp.lang.java.help)
  • Re: UI help - need to hide show panels
    ... > No dont do that, thats crazy. ... > parent when you call child.Create. ... > place-holder's RECT and pass that to the child dialog's Createfunction. ...
    (microsoft.public.vc.mfc)

Loading