[Zope] form variable types conflicts with javascript

Evan Simpson evan@4-am.com
Tue, 24 Jul 2001 23:58:34 -0400


From: "Albert Ting" <alt@sonic.net>
> Form type variables are great, but it causes a problem with
> Javascript.  Example:
>
>  <input name="default" type="checkbox"
>        onClick="setDefault(this,this.form.name:list)">
>  <input name="name:list" type="text">
>
> This doesn't work, as Javascript won't recognize name:list as a
> variable name when calling setDefault.  I've tried various
> combinations with no such luck.  Any suggestions?

This should work:

 <input name="default" type="checkbox"
       onClick="setDefault(this,this.form['name:list'])">

In general, Javascript allows you to use "container['name']" notation
instead of "container.name".

Cheers,

Evan @ digicool & 4-am