Rather than mess about with insane CSS hacks to try and reposition these elements, I can reorder them fairly easily in theme.xsl - great. However there is some code in xforms.js, in the ORBEON.xforms.Controls._getControlLabel function, which makes an assumption about the ordering of these elements: _getControlLabel: function(control, className) { var candidate = control; while (true) { if (candidate == null) break; if (ORBEON.util.Dom.isElement(candidate) && ORBEON.util.Dom.hasClass(candidate, className)) break; candidate = className == "xforms-label" ? candidate.previousSibling : candidate.nextSibling; } return candidate; }, This means the client side script can't see them, which means they don't get things like relevancy correctly updated. If this function is reworked so it doesn't care what order these elements are in, everything works fine. This is one possible approach - it's not as tidy as the above code, but in theory it's slightly 'safer' because it relies on the label@for attribute, and it works regardless of ordering: _getControlLabel: function(control, className) { var candidates = control.parentNode.children; for (var candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) { var candidate = candidates[candidateIndex]; if(ORBEON.util.Dom.isElement(candidate) && (candidate.htmlFor == control.id || (className == "xforms-help-image" && candidate.nextSibling && candidate.nextSibling.htmlFor == control.id)) && ORBEON.util.Dom.hasClass(candidate, className)) { return candidate; } } return null; }, Adrian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Adrian,
Good suggestion. I will let Alex integrate such a fix, and I entered an RFE to track this: http://forge.objectweb.org/tracker/index.php?func=detail&aid=306176&group_id=168&atid=350207 -Erik Adrian Baker wrote: > Lets say I wanted the help icon next to the label rather than the > control, and I wanted the hint text to display above the control rather > than alongside it. > > Rather than mess about with insane CSS hacks to try and reposition these > elements, I can reorder them fairly easily in theme.xsl - great. However > there is some code in xforms.js, in the > ORBEON.xforms.Controls._getControlLabel function, which makes an > assumption about the ordering of these elements: > > _getControlLabel: function(control, className) { > var candidate = control; > while (true) { > if (candidate == null) break; > if (ORBEON.util.Dom.isElement(candidate) > && ORBEON.util.Dom.hasClass(candidate, className)) > break; > candidate = className == "xforms-label" ? > candidate.previousSibling : candidate.nextSibling; > } > return candidate; > }, > > This means the client side script can't see them, which means they don't > get things like relevancy correctly updated. If this function is > reworked so it doesn't care what order these elements are in, everything > works fine. This is one possible approach - it's not as tidy as the > above code, but in theory it's slightly 'safer' because it relies on the > label@for attribute, and it works regardless of ordering: > > _getControlLabel: function(control, className) { > var candidates = control.parentNode.children; > for (var candidateIndex = 0; candidateIndex < candidates.length; > candidateIndex++) { > var candidate = candidates[candidateIndex]; > if(ORBEON.util.Dom.isElement(candidate) && > (candidate.htmlFor == control.id || > (className == "xforms-help-image" && > candidate.nextSibling && candidate.nextSibling.htmlFor == control.id)) && > ORBEON.util.Dom.hasClass(candidate, className)) { > return candidate; > } > } > return null; > }, > > Adrian > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |