IOElement has no server-side tools, so you can't read a text file with it. But you
could load up a server-side script that opens the file and generates a JavaScript
variable like so:
io = new IOElement(true);
dynapi.onLoad(function() {
// io commands must be done after load
io.load('readscript.asp?file=/my/text/file.txt', readIt);
// readscript.asp would generate <script>var text = "blah";</script>
});
function readIt(e) {
var text = e.getSource().getScope().text;
alert('message was: '+text);
}
So basically IOEelement supports http GET but can only read back JavaScript variables
(and as long as the script is on the same server). This is sufficient for a lot of
needs. But for true get/post and support Netscape, you need a Frame or a Java applet
system.
Dan Steinman
On Wed, Jan 09, 2002 at 12:01:04PM -0800, Raymond Irving wrote:
> Dan,
>
> So IOElement is a DynLayer with some methods?
>
> Well what if I want to retrieve all the characters
> from an html file? Can IOElement do that?
>
> My reason for wanting to do that is so that I can
> store html templates the server and then load them
> when needed and display then in a layer for form
> element.
>
> example:
>
> var io = new IOElement(true);
> io.load('formtemplate.html', fileload);
> mylayer = new DynLayer(null,10,10,100,100)
>
> // file load function
> fileload=function(e){
> var data=e.getSource().getData()
> var dt=new Date()
>
> data=data.replace(/\*current_date\*/g,dt.toString())
> // more replacments....
>
> mylayer.setHTML(data)
> }
>
> Will I be able to do the above with IOElement?
>
> Will IOElement support a post feature for posting data
> to a server?
>
> Will it ever support RPC (remote procedure calls)?
>
> --
> Raymond Irving
>
>
> --- Dan Steinman <[EMAIL PROTECTED]> wrote:
> > An IOElement example:
> >
> > <script>
> > var io = new IOElement(true); // true means a hidden
> > ioelement
> >
> > dynapi.onLoad(init);
> > function init() {
> > io.load('file.html', fileload);
> > }
> > function fileload(e) {
> > alert(e.getSource().getScope().myvalue); //
> > returns variable "myvalue" that is defined in the
> > file loaded
> > }
> > </script>
> > IOElement is more suitable for doing simple
> > communication through adding arguments to the URL -
> > file.html?value1=1&value2=2. I have an example that
> > will be included that shows how to use it. For more
> > complex communication it would be better to go with
> > a Frame communction scheme, or a java applet.
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/[email protected]/
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/