What I do when the javascript gets too hairy is to stick it in a DTML
Method and then do something like this::

<script type="text/javascript" tal:content="structure
here/the_script_dtml"></script>
or
<script type="text/javascript" tal:content="structure
python:here.the_script_dtml(here, request, parameterX='Y')"></script>

On 6/29/05, Rob Boyd <[EMAIL PROTECTED]> wrote:
> I'm stuck this, and would appreciate help or pointers.
> 
> I have a form with 2 selection drop-downs. I want the user's choice of
> select 1 to drive the options displayed in select 2. When the user
> makes a selection in select 1, onChange calls a Javascript function
> that should write select 2 options based on the result of a call to a
> Python script, passing the select 1 choice as an argument to the Python
> script.
> 
> But: I cannot get the Javascript var into the namespace that the TALES
> expression knows about.
> 
> Example:
> 
> <script>
> function makeDropDown() {
>   var widget = document.getElementById('select1');
>   var choice = widget.options[widget.selectedIndex].value;
>   var data = [result of calling Python script 'foo(arg)' with
> arg=choice]
>   // create options for select 2
> }
> </script>
> [various html...]
> <select id="select1" onChange="makeDropDown()">
> [options...]
> </select>
> 
> I've tried with multiple scripts, where one has tal:content=... but
> cannot figure out how the TALES expression can get at what my
> javascript gets from an event. I haven't done much with JavaScript
> inside Page Templates, so perhaps I'm going about this all wrong.
> 
> TIA,
> Rob
> 
> 
> 
> 
> __________________________________
> Discover Yahoo!
> Stay in touch with email, IM, photo sharing and more. Check it out!
> http://discover.yahoo.com/stayintouch.html
> _______________________________________________
> 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 )
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
_______________________________________________
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 )

Reply via email to