The only way I could see this possibly working without complicating
signed scripts/ActiveX privilege-escalation is:

var file = document.createElementNS("http://www.w3.org/1999/xhtml";,
"input");
file.setAttribute("type", "file");
file.onchange = function() {
    mySVGFileInputWidget.textContent = this.value; // whatever
}

file.click(); // activate the thinger?
// Maybe some creative use of DOM2 document.createEvent("MouseEvents")
// would work also

Calling click() on the input itself may not trigger the dialogue... so
maybe using DOM2 events to dispatchEvent() a click event positioned
where the "Browse" button should be would work. And, if it's not
within the document, then it may not even work at all (so maybe you
need to append it to some element first).

Lastly, the file itself obviously wouldn't be submitted...



What I might try doing is the following:

<html:object data="about:blank" type="text/html" id="form" width="0"
height="0"/>

Then whenever you create an SVG "form" element, create the equivalent
inside document.getElementById("form").contentDocument, and map
onfocus/onchange/onkeydown/etc events between your SVG elements and
the actual form elements... e.g. widget.onfocus = function() {
equiv.focus() } and equiv.onkeydown = function() { widget.textContent
= equiv.value } and so on. Then you could even much up form
submissions and make it all work nicely.

However, it's one big hack, and requires a compound document structure
(or a viewer supporting foreignObject); these limitations ultimately
remove IE+ASV support, leaving Firefox and Opera. But Firefox has
XForms support via an extension, which would be infinitely better than
this.


-Jason





--- In [email protected], "ddailey" <[EMAIL PROTECTED]> wrote:
>
> As an exercise in one of my classes, I've had students use SVG with 
> JavaScript to create familiar HTML-like form elements: buttons, radio 
> buttons, checkboxes, selects, text inputs, text areas, etc. (or at
least to 
> see how close then can get to the familiar behavior of those objects.) 
> Managing the events associated with mouse activity is a good excercise.
> 
> One thing that none of them has had any luck with, and I frankly
have no 
> suggestions to help, is the <input type="file"> object. Is there
anyway to 
> allow the user to peruse local drive space and based on the choice of a 
> file, modify the contents of a pure SVG document the way one would
in HTML?
> 
> I was about to declare the problem unsolvable, but thought I'd run
it by you 
> folks to see if someone has a clever workaround.
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to