On 20.03.2009, at 20:23, Szymek Przybył wrote:

I find some bug in phptal, i have such as input:

<input tal:attributes="onfocus php:nick?false:'this.value= \'\'';onblur php:nick?false:'if(this.value==\'\') this.value=\'Nick \'';value php:nick?nick: 'Nick'" type="text" name="nick"/>

In XML you can't escape quotes with backslash. You're supposed to use &quot; for this.

The bug here is not in replacing of dots, but in the fact that PHPTAL has accepted invalid XML.

Another thing, it's considered bad practice to put JS code inline in HTML. It's better to use progressive enhancement technique, e.g.

<input class="placeholder" title="Nick" />

and then write script that finds all elements with class placeholder and copy title attribute to value. e.g.

var inputs = document.getElementByTagName('input');
for(var i=0; i < inputs.length; i++)
{
        if (inputs[i].className != 'placeholder') continue;

inputs[i].onblur = function(){if (this.value == '') this.value=this.title} inputs[i].onfocus = function(){if (this.value == this.title) this.value=''}
        inputs[i].onblur();
}

--
regards, Kornel




_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to