W3C home > Mailing lists > Public > www-forms@w3.org > May 2007

RE: form control to select a folder

From: Klotz, Leigh <Leigh.Klotz@xerox.com>
Date: Thu, 24 May 2007 14:17:00 -0700
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF403257E4E@usa7061ms01.na.xerox.net>
To: Iņaki Salinas Bueno <inksalinas@gmail.com>
Cc: "www-forms" <www-forms@w3.org>
You don't have to use xsd:anyURI.  In fact, since it's a filename, not a resource path, URI may be the wrong abstraction; just a restriction of String with a known name may be enough.  Since XForms generically can't support this feature, XBL is the platform independent way of doing it (assuming XBL gets implemented elsewhere).  Your form markup then uses an abstract control that says what it's doing (input), and your type system declares the type (file directory), and the presentation layer (bound with XBL) describes how to do it in your environment.
See http://en.wikibooks.org/wiki/Talk:XForms/Formatting_a_date for an example of XBL and type binding in Mozilla.


From: Iņaki Salinas Bueno [mailto:inksalinas@gmail.com] 
Sent: Thursday, May 24, 2007 10:18 AM
To: Klotz, Leigh
Cc: www-forms
Subject: Re: form control to select a folder

Hi Leigh,

Thanks for your explanation, specially about the upload control and input control design. I understand it as an input control lack now.

	Furthermore, it is also difficult to see how, in the general case, a server that receives submitted data including a local filename (but no local contents) could access the specified file.

I suppose in the general case the objective of this input isn't to indicate the folder (or other resource) that the server can access (so upload control has no sense), but give information like any other input control about a URL. Difference would be that with this input control would be recommendable to use a dialog box like the upload control one. 

So I suppose it is a browser implementation poblem. And the problem is, once an input control is bound to a xsd:anyURI data, to know what type of resource the user wants to select (a folder or a file) using the dialog box. 

I'll think about use Mozilla XBL binding features and I'll keep www-forms informed if I do, but what I'm doing is a student project only, and the behaviour of the control I proposed is not an important part of the project (and I'm trying to do it platform independent), so I will forgive this feature by now. 



2007/5/18, Klotz, Leigh <Leigh.Klotz@xerox.com >: 

	We discussed this issue in a recent Forms Working Group meeting, and I'm responding based on the group's discussion. [1]
	The upload control is patterned after the HTML <input type="file"> element, which provides opaque access to a local filesystem file and the final component of the file name.  
	The XForms upload control is designed to access generic resources on the client and submit their contents to the server.  While these resources may be files, they could be any resource that is specified by the client user agent and which can be serialized into the submission.  The XForms Recommendation cites captured images (such as from a camera or scanner) and captured audio.  The XForms upload control optionally provides a media type (MIME type) and a filename.  Although XForms does not specify the definition of a filename, most implementations follow the HTML4 practice of including only the final filename component (i.e., without directory structure), for security reasons. Note that in neither HTML4 nor in XForms is it possible for the server side to obtain a full pathname and access that resource directly.
	Your use case doesn't not involve the upload of any client-side resource content, so it seems that the upload control is not the correct abstract control to use.  Furthermore, it is also difficult to see how, in the general case, a server that receives submitted data including a local filename (but no local contents) could access the specified file.
	In your application, you describe client extensions done in Java which use a browser permission model to grant permission for the Java code to access the local file; however, this requires extensions outside XForms and outside the scope of most browser interactions, due to security concerns prevalent in desktop browsers.
	Despite the fact that the upload control as implemented in the Mozilla Firefox extension uses a file selection dialog box, the control your use case calls for seems to be a variant of input, rather than a variant of upload.  The input control is responsible for getting user input for atomic values, and is also responsible for making use of user agent facilities to capture that input.  For example, when bound to an xsd:date type, the input control should offer some sort of date chooser.  An example use case might be a data-gathering application that wishes to record the filenames of configuration files on a user's system, but not necessarily provide access to those files.
	Unfortunately, at this point, the use case for a filename chooser does not seem to be general enough to warrant action by the Forms Working Group either for the changes to upload you request nor for the definition of a "filename" Schema simpleType in the XForms namespace.
	However, since your use case already involves implementation-specific details such as Java applets and the Mozilla security model, we recommend that you experiment with the Mozilla XBL binding feature.  You can define an XML Schema simpleType corresponding to a filename, and then use XBL to associate the "file chooser" behavior with input controls bound to this type.
	You may want to discuss this experimentation on the Mozilla XForms implementation discussion list, whose archive is available at https://lists.mozilla.org/listinfo/dev-tech-xforms <https://lists.mozilla.org/listinfo/dev-tech-xforms> 
	Please do keep www-forms informed if you have some results of experiments with XBL this use case, and let us know if this explanation is unclear, or if you think we've made a mistake.
	[1] http://lists.w3.org/Archives/Public/public-forms/2007May/att-0058/20070516-2.html#topic7 


	From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf Of Iņaki Salinas Bueno
	Sent: Tuesday, May 08, 2007 3:01 PM
	To: www-forms
	Subject: form control to select a folder
	Hi all,
	I want to suggest include the option of select a folder using upload form control (or another form control).
	My scenario is:
	- The user had a java.policy defined. This policy allows applets signed by X to write/read in a particular folder (choosed by the user). 
	- The signing applet (signed by X) must know this folder to be able to store the documents in the user's PC.
	- In the XForms+applet application, the user should enter the destination folder with other critical information and then call the applet sending it this parameters. 
	I have to use the input control and do copy&paste of the folder's path because the upload control isn't able to select a folder. I understand a folder as an URI, so I suppose a folder is included in the xsd:anyURI type definition, and the upload control is the manager of this type... reading the spec I don't see anything wrong in including folder selection in the upload control (well, avoiding filename, and maybe mediatype and size). 
	Aaron Reed explained me some problems on knowing if the user wants to select a folder or wants to select a file. I don't know how to solve this problem.
	My use case:
	<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> 
	<html    xmlns="http://www.w3.org/1999/xhtml"
	    <title>Test - Select a folder as input</title>
	    <script language="javascript">
	        function sign() {
	            //get the instance 
	            var model = document.getElementById("model");
	            var instance = model.getInstanceDocument("data");
	            //get parameter
	            var keystore = instance.getElementsByTagName("keystore");
	            var password = instance.getElementsByTagName("password");
	            var folder = instance.getElementsByTagName("folder");
	            //call the applet
	            document.applets.item("theapplet").sign(keystore[0].firstChild.nodeValue, password[0].firstChild.nodeValue, folder[0].firstChild.nodeValue);
	    <xforms:model id="model">
	        <xforms:instance id="data" xmlns="">
	                <keystore filename="" mediatype="" size="" /> 
	                <password />
	                <folder filename="" mediatype="" size="" />
	        <xforms:bind nodeset="instance('data')/keystore" type="xsd:anyURI"/> 
	        <xforms:bind nodeset="instance('data')/password" id="password" type="xsd:string"/>
	        <xforms:bind nodeset="instance('data')/folder" type="xsd:anyURI"/> 
	    <h1>Signing test</h1>
	    <h2>Key Access</h2>
	        <xforms:upload ref="instance('data')/keystore"> 
	            <xforms:label>Select your KeyStore</xforms:label>
	            <xforms:filename ref="@filename"/>
	            <xforms:mediatype ref="@mediatype"/>
	            <xforms:size ref="@size"/> 
	        <xforms:secret bind="password"><xforms:label>Password</xforms:label></xforms:secret>
	    <h2>Destination folder</h2> 
	        <xforms:upload ref="instance('data')/folder">
	            <xforms:filename ref="@filename"/> 
	            <xforms:mediatype ref="@mediatype"/>
	            <xforms:size ref="@size"/>
	            <xforms:action ev:event="DOMActivate">
	                <xforms:load resource="javascript:sign()"/>
	    <!--* APPLET FIRMA *-->
	    <applet    code="signing.Sign.class"
	            width="200" height="200" id="theapplet">
	        Signing no se ha podido cargar
	    <!-- -->
Received on Thursday, 24 May 2007 21:17:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:20 UTC