In my application I've cribbed from the xforms-upload example, but I
want to extend it so that the "upload" trigger is in readonly mode (inactive button) until the user has selected a file for upload. Below are the relevant parts of my view: <xforms:instance id="request-instance"> <form xmlns=""> <action/> <document-id/> <file filename="" mediatype="" size="" xsi:type="xs:anyURI"/> </form> </xforms:instance> <xforms:instance id="control-instance"> <control xmlns=""> <upload-trigger/> </control> </xforms:instance> <xforms:bind nodeset="instance('control-instance')/ upload-trigger" readonly="instance('request-instance')/file = ''"/> <xforms:group ref="instance('request-instance')"> <xforms:upload ref="file"> <xforms:filename ref="@filename"/> <xforms:mediatype ref="@mediatype"/> <xxforms:size ref="@size"/> </xforms:upload> <xforms:trigger ref="instance('control- instance')/upload-trigger"> <xforms:label>Upload</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="action">upload</xforms:setvalue> <xforms:send submission="upload- submission"/> </xforms:action> </xforms:trigger> </xforms:group> The bindind works, however the "upload" button never becomes active after browsing for a file to upload. I did a test with <xforms:output ref="file"/> and confirmed that the request-instance is not updated at run-time with the name of the file. I know how to do this with javascript, but is there an xforms way to make the upload trigger enabled only after the user has selected a file with the upload control? Many thanks in advance. Duane Gran -- 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
|
Duane,
> In my application I've cribbed from the xforms-upload example, but I > want to extend it so that the "upload" trigger is in readonly mode > (inactive button) until the user has selected a file for upload. > Below are the relevant parts of my view: [...] > The bindind works, however the "upload" button never becomes active > after browsing for a file to upload. I did a test with > <xforms:output ref="file"/> and confirmed that the request-instance > is not updated at run-time with the name of the file. I know how to > do this with javascript, but is there an xforms way to make the > upload trigger enabled only after the user has selected a file with > the upload control? With OPS, the upload control behaves slightly differently from other controls: the value of an instance data node to which xforms:upload is bound is not updated as you select a file in the web browser's upload widget. Instead the file is uploaded only when you perform a submission with replace="all" (we hope to support the other replace values soon), and you cannot assume that the value of the control changes as you tab in and out of it or as you select a file to upload. This explains why your code doesn't behave the way you would like it to behave. I could see how in the future we could provide an "instant upload" widget, which would start uploading as soon as you have selected a file (some have done this before us, and it's pretty neat for things such as email attachments, etc.), and which would set the value in the instance and fire xforms-value-changed when it completes. -Erik -- 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 |