Hello Mats,
I have investigated: this timer is inherited from AjaxForms.
I cannot say why it was added but I guess it was due to very old
browsers support.
Event management is still difficult and it is interesting to have a more
compliant behavior removing this timer.
Thanks!
--Alain
Le 30/01/2015 23:05, Mats Eklund a écrit :
Hi,
I'm trying to implement a form with an input field that has a hint
text shown within the field. The hint text should disappear when the
field is given focus by the user, and reappear upon loosing focus if
the field is left empty by the user.
Here's an example form.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Testing xf:input field with hint inline</title>
<xf:model>
<xf:instance>
<myfields xmlns="">
<search hint="Type here..."/>
</myfields>
</xf:instance>
<xf:setvalue ev:event="xforms-model-construct-done"
ref="search" value="@hint"/>
</xf:model>
</head>
<body>
<xf:input ref="search">
<xf:label/>
<xf:setvalue ev:event="DOMFocusIn" ref="." if=".=@hint"
value="''"/>
<xf:setvalue ev:event="DOMFocusOut" ref="." if=".=''"
value="@hint"/>
</xf:input>
</body>
</html>
I don't get this to work though. The hint reappears whenever the field
looses focus, whether user leaves it empty or not. I suspect this is
because XSLTForms seems to trigger the xforms-value-changed event and
updates the instance data only after triggering the DOMFocusOut event.
This seems not to be in accordance with the XForms spec
(http://www.w3.org/TR/2003/REC-xforms-20031014/slice4.html#rpm-event-seq-vcwfc).
I had a look within xsltforms.js, and noticed a deferred call
(setTimeout()) within XsltForms_control.blurHandler(), and suspect
this may be the problem. If I unwrapped the setTimeout() call, the
form worked fine. But I'm not sure if this has other side-effects, or
why there was a setTimeout() in the first place.
Thanks in advance for any suggestions!
Mats
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support