Yes, the way you would do this in prototype is to create an html element
such as a <button>, <link>, <input>, etc and add an onclick event handler to
that element. When the onclick event is invoked on that element, you would
want to use Element.insert() to dynamically insert a new file input element
to your form.
I hope this helps somewhat. I won't give out sample code for what you are
trying to accomplish, but maybe someone else will.
On Thu, Jul 1, 2010 at 12:50 PM, Pier <cpu...@gmail.com> wrote:
> On Jul 1, 12:53 am, Peter De Berdt <peter.de.be...@pandora.be> wrote:
> > On 01 Jul 2010, at 02:49, Pier wrote:
> > > Hi, I am pretty much new to Prototype, so I apologize if the question
> > > is a bit off.
> > > I have this form with only one file input element. What I want to do
> > > is add a new file input every time a file is selected to upload. Is
> > > there a way to do this using Prototype?
> > Use the click event in tandem with the change event, since file input
> > fields have very weird behavior across browsers. You'll have to keep a
> > record of the previous value though, to see if the value was indeed
> > changed, or if the control was simply clicked. You might be better of
> > just rethinking your strategy and allowing the user themselves to add
> > a new file field via an "Add file" button.
> > Best regards
> > Peter De Berdt
> Thanks for the reply Peter. Indeed I was thinking about including an
> "Add a file".
> Something I forgot to mention: the form will we displayed only in
> Firefox. Would this make it easier to keep an eye (or an ear) to the
> change event on the file input field?
> Thanks again
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at