Let me try to better describe what the problem is...

Let's say i create an Autocompleter, using
<input jwcid="@Autocompleter" id="europe:countries" ... />

Here's the generated html:

<select name="europe:countries" autocomplete="off" disabled="disabled" 
id="europe:countries"></select>
and it's valid.

But, in the case of the Autocompleter, that id (europe:countries) is also used 
to generate javascript
identifiers, so here's some js that gets generated:
var europe:countriesprop={"dataUrl":"blah", ... }

which is clearly invalid.

So, i see 3 solutions:

-) put out a big warning to users and component authors saying:
please DO NOT use - or : or . in your ids cause even though valid, we might 
use them as javascript variable names.

-) escape those characters either always or before using them in .script files

-) use a different way to create those javascript identifiers, one that doesn't 
depend on ids. For instance, instead of
var ${id}prop=something

do
<let key="betterId" unique="true">prop</let>
and then
var ${betterId}=something

A hybrid solution between 2 and 3 would be to allow an extra attribute for let, 
and use it as:
<let key="betterId" unique="true" javascript="true">${id}</let>

Anyway, please share your feelings about this.

P.S. This issue initially occurred while creating a new FormSupportImpl... in 
there i generate ids for 
form elements that go like this: form_id:element_id




-- 
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to