Re: Passing Values between XUL-Forms
Hi Keller,
Correction to my previous email: in doIt() below,
please change window.open(...) to
window.openDialog(...)
window.open(...) will not pass the parameter.
window.openDialog(...) will.
see
[url]http://developer.mozilla.org/en/docs/DOM:window.openDialog[/url]
Cheers,
am
--- AM <amemail1234-moz@yahoo.com> wrote:
[color=blue]
>
>
> The issue is: Form2 does not have access to the
> Form1
> DOM -- so
> document.getElementById("button1") is null when
> executed in Form2.
> If you put a try/catch block in doIt2(), you will
> see
> that.
>
> One possibility is: in window.open(...) in Form1,
> pass
>
> document.getElementById("button1").value to Form2,
> i.e.,
>
> function doIt()
> {
> window.open("chrome://plugin/content/Form2.xul",
> "form2",
> "chrome,
> width=350,height=120,centerscreen",
> document.getElementById("button1").value);
> }
>
> Then in Form2's xul, <dialog ...
> onload="form2Init();" > or <window ...
> onload="form2Init();" >
> i.e., add the onload=... if you don't already have
> one.
>
> Define a semi-global variable gArg1 available to
> Form2's javascript, and initialize
> it in form2Init():
> if ( window.arguments && window.arguments[0])
> gArg1 = window.arguments[0];
>
> gArg1 has document.getElementById("button1").value
> that you passed from Form1 window.
>
> function doIt2()
> {
> if (gArg1)
> document.getElementById("button2").value = gArg1;
> }
>
> Cheers,
> AM
>
>
>
>
> --- Keller Kind <kellerkind79@hotmail.de> wrote:
>[color=green]
> > Hello,
> > i have got the following Problem:
> >
> > I have got two Formulars written in XUL and one
> > JavaScript- File
> >
> > *Form1.xul:*
> > ....
> > <textbox id="name1"
> > ...
> > <button id="button1"
> > label="button1"
> > oncommand="doIt()"/>
> > ...
> >
> > *Form2.xul:*
> >
> > ....
> > <textbox id="name2"
> > ...
> > ...
> > <button id="button2"
> > label="button2"
> > oncommand="doIt2()"/>
> > ...
> >
> >
> > *code.js:*
> >
> > function doIt(){
> >[/color]
> window.open("chrome://plugin/content/Form2.xul",[color=green]
> > "form2",
> > "chrome,width=350,height=120,centerscreen");
> > }
> >
> > function doIt2(){
> > document.getElementById("button2").value =
> > document.getElementById("button1").value;
> > }
> >
> > This doesnt work!!!
> >
> > How can i pass the Values between these two Forms?
> >
> > Thx for Hints
> >
> >[/color]
>[/color]
_________________________________________________________________[color=blue][color=green]
> > Sie suchen E-Mails, Dokumente oder Fotos? Die neue
> > MSN Suche Toolbar mit
> > Windows-Desktopsuche liefert in sekundenschnelle
> > Ergebnisse. Jetzt neu!
> > [url]http://desktop.msn.de/[/url] Jetzt gratis downloaden!
> >
> > _______________________________________________
> > dev-extensions mailing list
> > [email]dev-extensions@lists.mozilla.org[/email]
> > [url]https://lists.mozilla.org/listinfo/dev-extensions[/url]
> >[/color]
>
> _______________________________________________
> dev-extensions mailing list
> [email]dev-extensions@lists.mozilla.org[/email]
> [url]https://lists.mozilla.org/listinfo/dev-extensions[/url]
>[/color]