XForms has standards for validation. Web Forms 2.0 has proposed standards for validation. XUL? Not so much.
One of the goals of XUL Widgets, as yet unstated (because I haven't written the manual) is to come up with some kind of convention for validating input from XUL. Now, in 99% of the cases you may not need much; how hard is it to validate a checkbox? But at least for <xul:textbox/>, I know of no standardized procedure for validating what the contents of it are. Likewise, I know of no standard way to disable the OK button of a <xul:dialog/> when there is something wrong with the inputs, other than by force from JavaScript.
Again, it may not be strictly necessary. But it is a nice-to-have option for XUL. So I'd like to ask readers: how would you standardize XUL input validation through the XBL bindings? I'll consider your answers, and probably try to incorporate them into the XUL Widgets project. I have my own ideas, of course, but they're not necessarily correct, and probably are incomplete. Also bear in mind validation may be extensible to widgets that don't exist in the current toolkit yet.
Posted by WeirdAl at December 9, 2005 6:25 PMHere is example of my xbl binding for that purpose.
Posted by: prefiks at December 10, 2005 1:11 AMI'd use XForms. Of course, I don't know yet how to do that, and XULRunner doesn't ship with XForms, but I'd do it that way somehow.
Um, this may seem rather simple, but why not just use xforms for validation of xul "forms"?
We've got the bindings for "embedding" xforms into xul.. and if something's not there that you want, you can skin any xforms element with whatever xul content you want via xbl. Please don't reinvent the wheel. thanks!
-woo
(From Alex: XForms support in Mozilla applications is not on by default at this point. That's the big reason why I'm not so impressed about that idea at first glance.
That said, where are these bindings? I'm willing to be convinced otherwise...)
Posted by: woo at December 10, 2005 4:04 PMthis bug is tracking most of the work for the xul versions of the bindings. Apparently it's not checked in yet :(
https://bugzilla.mozilla.org/show_bug.cgi?id=307627
There are examples in the bug for "embedding" xforms in xul.
If you are unfamiliar with xforms in general, definite hit http://xformsinstitute.com/essentials/browse/book.php
Posted by: woo at December 12, 2005 7:46 AMThe XForms extension for Firefox seems to be working fairly well - I think native XForms support will be included in the next major release.
Why not simply use the XForms Model module with XUL controls? The validation lies in the model, not the controls, and the XForms WG is encouraging people to use alternative UI's with the XForms models.
(From Alex: It's certainly a possibility.)
Posted by: Daniel Schierbeck at December 20, 2005 10:02 AMI think this would be the best approach:
<xforms:model>
<xforms:instance>
<data>
<bar>
<foo>Default</foo>
</bar>
</data>
</xforms:instance>
... validation goes here ...
</xforms:model>
...
<label control="foo" value="Foo"/>
<textbox id="foo" ref="data/bar/foo"/>
Posted by: Daniel Schierbeck at December 29, 2005 6:14 AM