Javascript wizards wanted for Zope project
Hi, I'm working on the VisualZope project and have run into some problems with javascript. Since it isn't my native language (python is) I was wondering if some javascript wizards are interested in getting their names in the credits. The problem is: how do I get a form to talk to an object in another frame? ie: <input value=".." ... onchange="mywidget.setAttribute('property', value-of-inputbox)> where mywidget is a javascript function defined in another (loaded) frame. Also, how can I "call" a html page without causing a reload: function jsZDOMsetAttribute(name, value){ call("getWidget/setAttribute?name=name&value=value") } For further information on this problem please see http://163.182.196.200/zwiki/VisualZope - jsZDOM reflecter part. Thanks in advance, Anthony Pfrunder
At 11:45 AM 11/17/99 +1000, Anthony Pfrunder wrote:
The problem is: how do I get a form to talk to an object in another frame? ie:
<input value=".." ... onchange="mywidget.setAttribute('property', value-of-inputbox)>
where mywidget is a javascript function defined in another (loaded) frame.
top.otherFrameName.objectName.method()
Also, how can I "call" a html page without causing a reload:
function jsZDOMsetAttribute(name, value){ call("getWidget/setAttribute?name=name&value=value") }
Create a "hidden" frame, i.e., one that is either zero width or zero height. Set the document.location.href of this frame to the URL you want to call. Note that this is asynchronous, however, and to find out if the page has been loaded, you'll need to make that page have an onLoad function to call back the original frame and say it's loaded (if you need it to do that). Depending on the complexity of your app, you may want/have to also have the caller implement a timeout to catch errors, and/or set up your Zope error page to have Javascript in it that signals an error back to that page. (Whew.)
The following example works in IE 4 and 5. Our company has standardized on IE so I have not yet tested this with Netscape but it should work there too. This is a a variation on a line out of an active page.: <input type=text name=address size=40 name=address maxlength=40 value=<dtml-var "_.string.strip(address)" null=''> onChange="opener.document.ContactForm.address.value=this.value"> This updates a field in the browser window that opened the window this code is in. Have also used nothing but javascipt in a child window to update fields in a parent window. The child form on load updates all the fields in the window that called it and then closes itself. This is handy when you have a complex data entry form with a lot of javascript functions (money formatting, autocalcs, ...)and a number of large select lists (some with 100 plus items). Using this routine, when you save a change to the form, you don't have to waste pipe space reloading the form, you just update the data. __________________________________________________________________ Jim Sanford . Database Engineer / \ / Accelerated Technology, Inc. / / 720 Oak Circle Drive East / / \ Mobile, AL 36609 / / \ Voice: 334-661-5770 fax: 334-661-5788 / \ E-Mail: jsanford@atinucleus.com Web: http://www.atinucleus.com Source Code, No Royalties, Any CPU...It just make sense ! __________________________________________________________________ ----- Original Message ----- From: Anthony Pfrunder <s341625@student.uq.edu.au> To: <zope@zope.org>; <zope-dev@zope.org> Sent: Tuesday, November 16, 1999 7:45 PM Subject: [Zope-dev] Javascript wizards wanted for Zope project
Hi,
I'm working on the VisualZope project and have run into some problems with javascript. Since it isn't my native language (python is) I was wondering if some javascript wizards are interested in getting their names in the credits.
The problem is: how do I get a form to talk to an object in another frame? ie:
<input value=".." ... onchange="mywidget.setAttribute('property', value-of-inputbox)>
where mywidget is a javascript function defined in another (loaded) frame.
Also, how can I "call" a html page without causing a reload:
function jsZDOMsetAttribute(name, value){ call("getWidget/setAttribute?name=name&value=value") }
For further information on this problem please see http://163.182.196.200/zwiki/VisualZope - jsZDOM reflecter part.
Thanks in advance,
Anthony Pfrunder
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
OOPS. Should have been: ...value="<dtml-var "_.string.strip(address)" null="">"...
here is a link I use often for javascript references http://www.coolnerds.com/jscript/javaref.htm ----- Original Message ----- From: Anthony Pfrunder <s341625@student.uq.edu.au> To: <zope@zope.org>; <zope-dev@zope.org> Sent: Tuesday, November 16, 1999 7:45 PM Subject: [Zope] Javascript wizards wanted for Zope project
Hi,
I'm working on the VisualZope project and have run into some problems with javascript. Since it isn't my native language (python is) I was wondering if some javascript wizards are interested in getting their names in the credits.
The problem is: how do I get a form to talk to an object in another frame? ie:
<input value=".." ... onchange="mywidget.setAttribute('property', value-of-inputbox)>
where mywidget is a javascript function defined in another (loaded) frame.
Also, how can I "call" a html page without causing a reload:
function jsZDOMsetAttribute(name, value){ call("getWidget/setAttribute?name=name&value=value") }
For further information on this problem please see http://163.182.196.200/zwiki/VisualZope - jsZDOM reflecter part.
Thanks in advance,
Anthony Pfrunder
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
This is an amazing cross-browser OO DHTML library, which should be very useful to all Zope developers in general: http://www.dansteinman.com/dynduo/ -- Itamar S.T. itamars@ibm.net
I know you have been given many answers, but I'll bud in anyway. I've done way too much JavaScript, I like to think I know it's pitfalls. At 02:45 17/11/99 , Anthony Pfrunder wrote:
The problem is: how do I get a form to talk to an object in another frame? ie:
<input value=".." ... onchange="mywidget.setAttribute('property', value-of-inputbox)>
where mywidget is a javascript function defined in another (loaded) frame.
You can just refer to it's name via the frameset that defines it, like parent.nameofotherframe,mywidget.setAttribute(), but you can never be sure that the other frame has been loaded. To get around this problem, I use an asynchronous message broker in the parent frame. The calling frame checks for a boolean property on it's parent to check wether or not it is capable of doing the messaging, then calling a method on this parent that'll pass on the message to the receiving frame: onLoad="if (parent.bIsTop) parent.setMenu('foo')" The receiving frame sets a boolean flag on the same parent frame to signal it is ready to receive messages: onLoad="if (parent.bIsTop) parent.bNavLoaded = true;" You can now use setTimeout, and a counter, to pass the message on. As long as bNavLoaded (the flag indicating messages can be passed on) is false, and we haven't tried too many times yet, wait a specified time and try again. A real life example using two way message passing is used on http://www.marantz.com/, in both the Hifi and Professional sections (altough I don't think the Professional section is live yet). In the Hifi section, the navigation frame signals the right hand frame on mouse-over events to show descriptions of the menu choices, and the right hand frame, when deeper into the site, signals the navigation frame to tell it what menu option to display. This way the user can use te back and forward buttons of his browser to step through it's browsing history, and the navigation menu follows suit.
Also, how can I "call" a html page without causing a reload:
function jsZDOMsetAttribute(name, value){ call("getWidget/setAttribute?name=name&value=value") }
For further information on this problem please see http://163.182.196.200/zwiki/VisualZope - jsZDOM reflecter part.
For this one you'll need a hidden frame (width or height of 0), or you could use a hidden DynDuo Layer and use it's load method: http://www.dansteinman.com/dynduo/en/dynlayer-common.html You should be able to then also read attributes from the server with this. Just have the server return a page with javascript in it that does the trick. Just remember, that you cannot wait for the page to load and expect it to return a value, you'll have to write something asynchronous (and non-blocking, Navigator's Javascript implementation is single threaded, use setTimeout) to retrieve the value. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (5)
-
Anthony Pfrunder -
Itamar Shtull-Trauring -
Jim Sanford -
Martijn Pieters -
Phillip J. Eby