javascript vars in dtml
Hi! i would like to know if its possible to pass javascript variables to dtlm methods. for example: <script type="text/javascript"> function general(){ var t="hello" /* here is the problem until now within dtml the they dont recognize the t var */ <dtml-in "func(t)"> ... </dtml-in> } </script> thanks O SAPO já está livre de vírus com a Panda Software, fique você também! Clique em: http://antivirus.sapo.pt
it is *not* possible.. DTML is server side scripting, javascript is client side scripting. dragos cla wrote:
Hi!
i would like to know if its possible to pass javascript variables to dtlm methods.
for example: <script type="text/javascript">
function general(){
var t="hello"
/* here is the problem until now within dtml the they dont recognize the t var */
<dtml-in "func(t)"> ... </dtml-in>
}
</script>
thanks
O SAPO já está livre de vírus com a Panda Software, fique você também! Clique em: http://antivirus.sapo.pt _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Am Freitag, den 25.02.2005, 11:41 +0000 schrieb cla:
Hi!
i would like to know if its possible to pass javascript variables to dtlm methods.
for example: <script type="text/javascript">
function general(){
var t="hello"
/* here is the problem until now within dtml the they dont recognize the t var */
<dtml-in "func(t)"> ... </dtml-in>
}
</script>
thanks
You are confused :-) JavaScript is entirely interpreted by the client - the client gets the page after the server has fully processed it. Redesign your approcach :-) Regards Tino
From: "Tino Wildenhain" <tino@wildenhain.de> Subject: Re: [Zope] javascript vars in dtml
Am Freitag, den 25.02.2005, 11:41 +0000 schrieb cla:
Hi!
i would like to know if its possible to pass javascript variables to dtlm methods.
for example: <script type="text/javascript">
function general(){
var t="hello"
/* here is the problem until now within dtml the they dont recognize the t var */
<dtml-in "func(t)"> ... </dtml-in>
}
</script>
thanks
You are confused :-) JavaScript is entirely interpreted by the client - the client gets the page after the server has fully processed it.
But, in the case where you want javascript to process user entered data, or to provide additional information based on some user action, you have two options (that i can think of, there are probably more!): 1) have javascript create additional 'form' fields containing the info you want passed back to dtml/scripts (said form fields can then be processed as usual) 2) create a hidden iframe in your html page; use javascript to reload this page by building a url (with data parameters) which invokes a dtml/script routine. The dtml/script can process the parameters passed in the url and then pass whatever you want back to the client where your javascript can then interpret the response from the dtml/script. This is a nice way of communicating between the client and your zope site without the user seeing page reloads. hth Jonathan
cla wrote:
Hi!
i would like to know if its possible to pass javascript variables to dtlm methods.
for example: <script type="text/javascript">
function general(){
var t="hello"
/* here is the problem until now within dtml the they dont recognize the t var */
<dtml-in "func(t)"> ... </dtml-in>
}
</script>
You must be carefull not to mix (in your mind) what happens on the client and what happens on the server. DTML is server base. It is used to generate a html-page and that is sendt to the client. The server knows nothing about Javascript. Javascript on the other hand is clent based. It "happens" after the client has recieved the html document from the server. The client knows nothing about DTML. Robert
participants (5)
-
cla -
Dragos Chirila -
Jonathan Hobbs -
robert -
Tino Wildenhain