Click to See Complete Forum and Search --> : tfer textfield value between parent and child (post preview-like)


sandy
01-22-2003, 12:56 PM
hi guys

I've exhausted my usual friends with this problem, so I've arrived at ur doorstep in search of some answers.

The purpose of this script is the same as a 'preview post' we get in forums. Users add text to a textarea then format it using schmick buttons to insert tags.

The function I'm using to set up the preview pop-up is:

(parent textfield in Q'n is ..postContent.content.value)

function launch(newURL, newName, newFeatures, orgName) {
var remote = open(newURL, newName, newFeatures);
if (remote.opener == null)
remote.opener = window;
remote.opener.name = orgName;
return remote;
}

function launchPreview() {
window.open("reply_preview_pop.asp", "PreviewContent", "height=400,width=600,yada yada yada,"contribText");
}

This function is called by the preview button and the preview window opens up fine.

However the problem lies with my being able to insert the text from the parent textfield into some span tags of the child.

I've tried far too many various functions, none seem to work and I'm not sure if Im targeting the opener's textfield ID correctly either.

The POS script in the child window looks like this atm.. it's changed considerably over the last 2 days when I feel like nagging it.

(child target is window(?).insertHere.value)

function display(NewCode) {
document.insertHere.value+=NewCode
}
function tfer() {
AddTxt=window.contribText.postContent.Content.value
display(AddTxt)
}
function start() {
window.focus()
tfer()
}

and it called by an onLoad="start()" in the head tags.

I've ID'd some span tags further down the child page as "insertHere" :-|

The site's using asp/javascript and I wont use cookies to solve this problem, nor session variables [in asp]. Im sure the idea behind this script is sound, I just dont know the syntax.

p.s. innerHTML is out since it's IE specific, I'd prefer a cross browser solution...

thx in advance guys.

sandy
01-23-2003, 07:02 PM
hmmm...

slipping to page 3 without reply - not good.

I've tried simplifying things to little effect...


parent function...

function launchPreview() {
preview = window.open("reply_preview_pop.asp", "PreviewContent", "height=400,width=600,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resiz able=0,scrollbars=1,status=0,toolbar=0");
}

child function...

function setText()
{
document.getElementById('getText').firstChild.nodeValue = window.opener.document.postContent.Content.value;
}


calls to functions were renamed to suit. 'getText' is the ID for the span tags recieving the value.

I seem to be going around in circles here. I cant garner a solution from the popular sites or books; most scripting goes over my head at this stage, hence the simplified solutions....

Anyone got any ideas? Someone point me in another direction plz...