[Xsltforms-support] XsltForms_control.prototype.changeProp = function(node, prop, onTrue, onFalse,
Brought to you by:
alain-couthures
From: Adam M. <Ada...@gm...> - 2012-11-30 00:59:26
|
Hello fans of XsltForms, and Alain in particular :) I was just testing with r562, and I noticed that when an element is marked as *required* and it has no value (node.value === ""), the node is given the *notvalid* property, but this doesn't translate into the corresponding HTML control element receiving the *xforms-invalid* attribute (it continues on with *xforms-valid* attribute). I found new code at the start of *XsltForms_control.prototype.changeProp()*which seems to be responsible for this. The effect of the new code seems to be that *notvalid* is taken to be false when the new value is empty and there's been no validation error. It seems as if the code is at odds with itself a bit here -- one part of the code gives the node the *notvalid*property, but other code overrides that. Consider a node with all the following properties: *** has an empty value (node.value === '') *** has property *required* * * *has attribute *xsi:nil='true'* (automatically set via a bind when the value is empty) * has corresponding type that specializes *xs:string* to require min-length = 1 The control for such a node seems to retain *xforms-valid* attribute because of the new code in *XsltForms_control.prototype.changeProp()*. If * XsltForms_control.prototype.changeProp()* only returned *XsltForms_browser.getBoolMeta(node, prop)* (as before) then the control would receive the attribute * xforms-invalid*. Should the new code in *XsltForms_control.prototype.changeProp()* be changed to consider *xsi:nil* ? A node which is *nil*, but is also required - can surely not be considered valid. Please let me know your thoughts on this. Thanks very much for all your work on this excellent project :) /Adam |