473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamically causing file browser to appear

Hi,

I need to capture an event on a form file input button and present a
dialog before allowing the user to browse for a file. (A customer
needs this in a CMS that I'm customizing for them.) Capturing the
click is easy:
<form>
<input type="file" id="theButton" />
</form>

function theFunction() {
// do something
return false;
}

document.getEle mentById("theBu tton").onclick = theFunction;

The function presents a TOU in a div; when the user clicks "I Agree"
the browse dialog should appear. Everything works but forcing the
browse dialog to appear after accepting. I assumed something like

document.getEle mentById("theBu tton").onclick = theOriginalFunc tion;
document.getEle mentById("theBu tton").click();

would work, but no dice. focus() doesn't work, either.

Ideas? This needs to be cross-platform, but I'm developing on OS X w/
Firefox 3.

Thanks,

Walter
Nov 1 '08 #1
6 1380
On Nov 1, 4:42*pm, walter-goo...@easypeas .net wrote:
Hi,

I need to capture an event on a form file input button and present a
dialog before allowing the user to browse for a file. *(A customer
needs this in a CMS that I'm customizing for them.) *Capturing the
click is easy:
What is this dialog supposed to do? Why do you feel you need to
present it just before the browser dialog?
<form>
* <input type="file" id="theButton" />
</form>
Actually, that is not a button.
>
function theFunction() {
* // do something
Showing a (non-standard) modal dialog is all you can do here. (FF3
and IE4+ are the only agents I know of that support this.)
* return false;
Return the appropriate value based on the result of the modal dialog.

https://developer.mozilla.org/en/DOM...howModalDialog
>
}

document.getEle mentById("theBu tton").onclick = theFunction;
The irritating thing about this is it breaks the accompanying
textbox. My host's "control panel" application does this, but then
they do a lot of stupid things.
Nov 1 '08 #2
David Mark wrote:
On Nov 1, 4:42 pm, walter-goo...@easypeas .net wrote:
>document.getEl ementById("theB utton").onclick = theFunction;

The irritating thing about this is it breaks the accompanying
textbox. [...]
Looks like with Fx3/Win it has been broken already. I find it a rather
stupid default that a click on the accompanying textbox now works like a
click on the button; it makes the attempt at seeing what the full selected
filename is a PITA.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Nov 2 '08 #3
Thanks for your reply. At this point in development, I need to
justify changing our customer's wishes with a good reason. For this
reason, I'd like to know if it's possible to activate a file browse
input activity dynamically or not.

The customer is a national professional society, and requires that
people posting documents (done via the form I'm working on) agree to
their TOU. Their TOU statment is several paragraphs long; because of
this and aesthetic reasons, we decided to go against the modal dialog.

My research shows that overriding the browse button works in FF, IE
and Safari; these are the only browsers we test against or guarantee,
so if it doesn't work elsewhere, that's acceptable.

Probably a better way to do it would be to wait for the submit and
bring it there. A problem is that several documents can be attached
simultaneously (using the same input field), meaning a person may
browse for several documents and finally refuse the TOU, thus
potentially pissing them off.

Anyway, is the dynamic activation of a browse input possible? That's
what I really need to know now.

Thanks,

Walter

On Nov 1, 1:55*pm, David Mark <dmark.cins...@ gmail.comwrote:
On Nov 1, 4:42*pm, walter-goo...@easypeas .net wrote:
Hi,
I need to capture an event on a form file input button and present a
dialog before allowing the user to browse for a file. *(A customer
needs this in a CMS that I'm customizing for them.) *Capturing the
click is easy:

What is this dialog supposed to do? *Why do you feel you need to
present it just before the browser dialog?
<form>
* <input type="file" id="theButton" />
</form>

Actually, that is not a button.
function theFunction() {
* // do something

Showing a (non-standard) modal dialog is all you can do here. *(FF3
and IE4+ are the only agents I know of that support this.)
* return false;

Return the appropriate value based on the result of the modal dialog.

https://developer.mozilla.org/en/DOM...howModalDialog
}
document.getEle mentById("theBu tton").onclick = theFunction;

The irritating thing about this is it breaks the accompanying
textbox. *My host's "control panel" application does this, but then
they do a lot of stupid things.
Nov 2 '08 #4
wa***********@e asypeas.net wrote:
Thanks for your reply.
Which reply?
At this point in development, I need to justify changing our customer's
wishes with a good reason. For this reason, I'd like to know if it's
possible to activate a file browse input activity dynamically or not.
It's not. Satisfied?
The customer is a national professional society, [...]
Entirely irrelevant.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 2 '08 #5
On Nov 2, 9:28*am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
David Mark wrote:
On Nov 1, 4:42 pm, walter-goo...@easypeas .net wrote:
document.getEle mentById("theBu tton").onclick = theFunction;
The irritating thing about this is it breaks the accompanying
textbox. *[...]

Looks like with Fx3/Win it has been broken already. *I find it a rather
Really? As in, you can't select the text in the textbox at all?
Maybe it wasn't a bad script to blame after all (just a bad browser.)
Nov 3 '08 #6
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
>David Mark wrote:
>>On Nov 1, 4:42 pm, walter-goo...@easypeas .net wrote:
document.get ElementById("th eButton").oncli ck = theFunction;
The irritating thing about this is it breaks the accompanying
textbox. [...]
Looks like with Fx3/Win it has been broken already. I find it a rather

Really? As in, you can't select the text in the textbox at all?
You can select the text using a pointing device, but once you release the
button over the control you get the file select dialog like when you just
clicked anywhere within the control. In my "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" at least;
an extension might interfere, YMMV.
Maybe it wasn't a bad script to blame after all (just a bad browser.)
Maybe, although I would like to emphasize that this nasty little bug does
not make Firefox a bad browser :)
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Nov 3 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2645
by: Dan Stromberg | last post by:
Are there any reasonably secure file browser implementations for unix/linux (and perhaps MacOS X and Windows as well) written in python, that are accessed over https via a cgi script? Thanks.
1
1334
by: bugman | last post by:
The problem started with Firefox. Got to www.foxnews.com and click on any of the scrolling headlines in the right hand box. Firefox would crash. Now Opera and IE do also. If I disable javascript in Firefox the headlines do not show. Same behavior on my laptop, which is configured in a similar fashion. What could be causing any browser on...
0
1741
by: purespam | last post by:
How can I dynamically add file links to a html document? I need to be able to click an image icon and the "Open file" box should pop up where I can select a document from my harddisk. The document should then be added to the html file at a specific spot and the file reloaded with the new document added to the html file showing. This new...
4
7693
by: redneon | last post by:
I've written a simple application which connects to an FTP server and recursively lists the contents of the directories in this server in a ListBox. What I'm wanting to do is change the ListBox and instead, use something like the Windows file browser. Like when you go through My Computer, that kind of thing. Looking at the components that...
4
23722
by: Peter Larsen | last post by:
Hi, I want to be able to show a file browser embedded on a form - a browser which is similar to the browser you get by SHBrowseForFolder(). Is that possible ? Thank you in advance. BR Peter Larsen
1
2044
by: Jables | last post by:
I am looking for a solution to an online file browser. The browsing is not browsing a persons harddrive, so it is isn't really a file browser, but it is browsing a tree of strings generated by the server. Any ideas?
3
7434
by: TheSaint | last post by:
hi there, I've started to build a GUI for my Mailsweeper by the help of QT4 Designer. I came across the problem that there isn't any prebuild file browser like Kdialog. I know some other sample, but PyGTK builded. I'm not happy to use a different widget set or to have to design my own file browser with QT4 widgets. It's almost thousand...
2
2035
by: jennise | last post by:
Hello I am using the DoCmd.TransferText to write a macro to import dynamically named file from a filepath. My macro written as follows: Sub TestTransferText() DoCmd.TransferText acImportDelim, , _ "tblportfolio", "M:\AACP\AACP PORTFOLIO 09-19-2008" & Format$(Date, "mm-dd-yyyy") & ".csv", True
1
6248
by: alnino | last post by:
Hi, On a form I have a command button that allows a user to browse for a file (PDF, Word, etc…). This command button then stores a hyperlink to the file within an associated txtfield in the table. The VB to browse for the file is as follows Private Sub CmdBuildingAdd_Click() Me!txtSelectedFile = BrowseFiles()
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.