[Xsltforms-support] file:// support
Brought to you by:
alain-couthures
From: COUTHURES A. <ala...@ag...> - 2011-02-18 21:40:14
|
Hello, I have added "file://" support in submission allowing users to save and restore data instances on local disk with regular files. This is based on a Java applet. There are some integrated security restrictions such as forbidden file extensions (.exe,...) and maximum size (100 Mo). BOM is not yet supported. Each time, a Java file dialog is displayed to allow the user to select the folder and to enter the file shortname. This dialog is initialized with the path after "file://", if any. I have tested this successfully on Windows with FireFox, IE and Chrome (there were some errors before accepting the applet, maybe wait instructions (1 or 2 seconds) might help...) but it doesn't work yet with Opera. Please find my test case below. Thank you for your feedbacks! -Alain ------------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <title>Address Form</title> <xf:model> <xf:instance> <Address xmlns=""> <LocationStreetFullText/> <LocationCityName/> <LocationStateName/> <LocationPostalID/> </Address> </xf:instance> <xf:submission id="save" method="put" replace="none" action="file://"> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> </xf:submission> <xf:submission id="load" method="get" serialization="none" replace="instance" action="file://"> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> </xf:submission> </xf:model> </head> <body> <xf:group ref="/Address"> <fieldset> <legend>Mailing Address</legend> <xf:input ref="LocationStreetFullText"> <xf:label>Street: </xf:label> </xf:input> <br/> <xf:input ref="LocationCityName"> <xf:label>City: </xf:label> </xf:input> <br/> <xf:input ref="LocationStateName"> <xf:label>State: </xf:label> </xf:input> <br/> <xf:input ref="LocationPostalID"> <xf:label>Postal Code: </xf:label> </xf:input> </fieldset> </xf:group> <xf:submit submission="save"> <xf:label>Save to local disk</xf:label> </xf:submit> <xf:submit submission="load"> <xf:label>Restore from local disk</xf:label> </xf:submit> </body> </html> |