From: Ronald v. K. <Rva...@in...> - 2011-10-09 08:14:24
|
No problem. We always roll our own branch, so we can use the fix (a fix) ourselves. I have some othe fixes/enhancements as well and will make individual pull requests for them in git and some perculiar behaviour with date time in relation to validity. Have some time again the comming period, so stay tuned for more. Ronald ________________________________________ Van: Joern Turner [joe...@be...] Verzonden: vrijdag 7 oktober 2011 19:12 Aan: bet...@li... Onderwerp: Re: [Betterform-users] upload with ref to non-existing instance node fails Hi Ronald, sorry for not replying. We are heads-under at the moment with our homepage renewal so no time yet to look into this non-trivial case. But of course we'll consider that for the final. Cheers, Joern Am 29.09.11 15:25, schrieb Ronald van Kuijk: > All, > > Long time no post and I noticed yesterday I missed a lot, lot of mail. > Great to see the usage of betterFORM being so active. > > We recently started using the XForms upload functionality and > encountered an issue when we display the form again with an instance > that was the result of a former submission. In this instance the element > for the upload is missing since no document was originally uploaded. > > > 2011-09-28 17:09:59,123 WARN [de.betterform.xml.xforms.ui.Upload] : > Node for path 'docs' does not > exist:/xhtml:html[1]/xhtml:body[1]/xhtml:div[3]/xforms:group[1]/xforms:group[1]/xforms:upload[1] > 2011-09-28 17:09:59,126 ERROR [de.betterform.xml.xforms.ui.Upload] : > /xhtml:html[1]/xhtml:body[1]/xhtml:div[3]/xforms:group[1]/xforms:group[1]/xforms:group[1]/xforms:group[1]/xforms:group[1]/xforms:upload[1]/@id[.='C371'] > binding exception: {defaultinfo=Datatype not supported by this > control: string} > > > In Upload.java a sanity check takes place for supported datatypes: > String datatype = getDatatype(); > > String datatype = getDatatype(); > > // convert binary data according to bound datatype > if ( !(validator.isRestricted("base64Binary", datatype) || > validator.isRestricted("hexBinary", datatype) || > validator.isRestricted("anyURI", datatype)) ) { > this.container.dispatch(this.target,XFormsEventNames.BINDING_EXCEPTION, > datatypeErrorMsg + datatype); > return; > } > > getDatetype() returns 'string' if no datatype can be found for the > upload which is an invalid value for upload, hence the exception. > > public String getDatatype() throws XFormsException { > if (hasBindingExpression()) { > Node n = getInstanceNode(); > if(n == null){ > getLogger().warn("Node for path '" + getBindingExpression() + "' > does not exist:" + DOMUtil.getCanonicalPath(this.element)); > //TODO: clarify what to do > //throw new XFormsException("Node for path '" + > getBindingExpression() + "' does not exist::" + > DOMUtil.getCanonicalPath(this.element)); > } > ModelItem modelItem = > this.model.getInstance(getInstanceId()).getModelItem(n); > if (modelItem != null) { > return UIElementStateUtil.getDatatype(modelItem, this.element); > }else{ > return "string"; > } > } > return null; > } > > hasBindingExpression checks for the existence of a bind or ref attribute > on the control (we use a ref). It then checks for the existence of an > instance in which this element occurs (which is only the case for new > forms with a full new instance where the node is present). > > This error on the server side can be 'fixed' (worked around) by adding > an additional check in the Upload.java for "string" value and *assume* > then the node is not present. A better solution would be to actually try > to find the corresponding bind and retrieve the type from that, but I > could not achieve that yet. > > If this is fixed, there is a similar error on the client side in the > UIElementFactoryImpl.js where the widget is not created due to an empty > datatype (seen in the host dom) > > createUploadWidget:function(sourceNode, controlId, datatype, > classValue) { > if(datatype == "base64" || datatype == "base64Binary" || datatype == > "hexBinary" || datatype == "anyURI") { > return new betterform.ui.upload.UploadPlain({ > "class":classValue, > title:dojo.attr(sourceNode,"title"), > xfControlId:controlId > }, sourceNode); > > } else { > console.error("Upload (" + controlId+"): unsupported datatype: ", > datatype); > return null; > } > > }, > > This can also be worked around by adding an additional check in the else > > if (datatype == "" || datatype == undefined) { > console.warn("Upload (" + controlId+"): unsupported datatype: ", > datatype); > console.warn("Likely due to non-existing instance node and the > datatype not being decided based on the bind"); > return new betterform.ui.upload.UploadPlain({ > "class":classValue, > title:dojo.attr(sourceNode,"title"), > xfControlId:controlId > }, sourceNode); > } > > When the upload starts working then if there is not element in the > instance, but I think it should work without this 'workaround' > > Also using a bind on the upload which points to the id of the > corresponding xforms:bind does not work either, but that might result in > a 'neater' solution if persued. > > Any thoughts? > > Cheers, > > Ronald > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > > > > _______________________________________________ > Betterform-users mailing list > Bet...@li... > https://lists.sourceforge.net/lists/listinfo/betterform-users ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Betterform-users mailing list Bet...@li... https://lists.sourceforge.net/lists/listinfo/betterform-users |