You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/08/21 21:59:46 UTC

image button for file upload

I've been reading some interesting methods for
using image buttons on forms in place of the
familiar "Submit" style browser generated
buttons. There is one automatically generated
button that I am still puzzled on how to use
an image for it, though. That's the one for
do file uploading, as in:

<html:form method="POST" enctype="multipart/form-data">
<html:file property="theFile"/>
<html:submit value="Upload"/>
</html:form>

Any ideas?
Dean Hoover



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Erik Weber wrote:

> Awesome. Now, do you have any idea how I could change the font or the 
> text of the button, without actually making it an image?


Well that is an entirely different matter, Erik, and a much simpler 
one.  But, it is not the problem I have. 

I am trying to put together for struts or for taglibs a generic solution 
to web problems with images buttons and forms.  I actually have created 
a taglib that makes an image into anything I want on the fly, so I can 
change the font, text or anything else and still make it a button.  It 
also, by the way, is Internationalized.  I am looking at this problem as 
the last part of that solution.  When done, I will never have to worry 
about buttons again for five months.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Erik Weber <er...@mindspring.com>.
Awesome. Now, do you have any idea how I could change the font or the 
text of the button, without actually making it an image?

Michael McGrady wrote:

> So far I have this, Erik, which works in IE but not in Mozilla.  
> Anyone have any other ideas on this?  I did this before but lost it in 
> a computer crash.
>
> <form method="get" action='boogie-woogie'>
> <input type='file' name='browse' style='display: none;'>
> <input type='text' name='file'>
> <input type='image' onClick='browse.click();file.value=browse.value;' 
> src='browse.gif'>
> </form>
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Michael McGrady wrote:
>
>>
>>>
>>>
>> Hi, Dean,
>>
>> I am a pretty meat and potatoes kind of genius.  I need to solve one 
>> thing at a time.  So, right now I am going to stick with only the 
>> image deal with file uploads.  I have the following which works okay 
>> with IE but not with Mozilla.
>>
>> <form method='get' action='display_none.jsp'> 
>
>
> What does the jsp do? Are you sure that upload is really happening? I 
> think
> in order for upload to occur the form has to have 
> enctype="multipart/form-data"
> in it, doesn't it? That's what I've always done, but I learned it so 
> long ago that
> I just cookbook it now.


Perhpas I should have added that I knew this would not upload, since 
there is no submit button for the form.  The browse button is not a 
submit button.  I have no difficutlty with submit buttons.  I use the 
solution I have given at 
http://wiki.apache.org/struts/StrutsCatalogMultipleImageTagsSimplified 
.  Myself, I think that LookupDispatchAction is just a waste of the 
input attribute and also that it is over engineered.  That is not 
surprising, of course, since I have developed a number of alternatives.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Michael,
>
> I thought you said you hadn't actually done the upload.
> That's what I'm talking about. So, even if you can get
> a file path to show up in a text input in response to hitting
> a browse image button, I still think it will not work, even
> in IE. Even though you are on a mission to make what
> you've done cross browser, if you can't upload it was a
> waste of time. Why don't you try making it actually upload
> on IE? If you can get that to work, I'll stand corrected, and
> will try to get the same working on Mozilla.
>
> Dean


Fair enough!  I don't have time to replicate it now but I will in the 
next few days.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Michael,

I thought you said you hadn't actually done the upload.
That's what I'm talking about. So, even if you can get
a file path to show up in a text input in response to hitting
a browse image button, I still think it will not work, even
in IE. Even though you are on a mission to make what
you've done cross browser, if you can't upload it was a
waste of time. Why don't you try making it actually upload
on IE? If you can get that to work, I'll stand corrected, and
will try to get the same working on Mozilla.

Dean

Michael McGrady wrote:

> Dean A. Hoover wrote:
>
>> Michael,
>>
>> I'm still researching on the web and alot of what I am seeing
>> is that it is not possible. There is mention that this is strongly
>> controlled by the browser for security purposes, to prevent
>> malicious websites from uploading files on the client box
>> by just doing javascript hacks. Seems to make sense to me,
>> but if its true, its disappointing since its probably the only
>> button we can't replace with an image.
>>
>> Dean
>
>
>
> Dean, it is possible because the code I sent to you does it in IE.  
> The ONLY remaining issue is how to do it in other browsers.  Okay?  It 
> cannot be impossible, I have done it with what I sent you.  There is a 
> set of people who always answer right away that these things cannot be 
> done, but they can.  That they can makes sense, because there is no 
> reason why the objects behind the javascript could not do this.  Give 
> me some urls that you think are convincing, if you think so still.
>
> Michael McGrady
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Michael,
>
> I'm still researching on the web and alot of what I am seeing
> is that it is not possible. There is mention that this is strongly
> controlled by the browser for security purposes, to prevent
> malicious websites from uploading files on the client box
> by just doing javascript hacks. Seems to make sense to me,
> but if its true, its disappointing since its probably the only
> button we can't replace with an image.
>
> Dean


Dean, it is possible because the code I sent to you does it in IE.  The 
ONLY remaining issue is how to do it in other browsers.  Okay?  It 
cannot be impossible, I have done it with what I sent you.  There is a 
set of people who always answer right away that these things cannot be 
done, but they can.  That they can makes sense, because there is no 
reason why the objects behind the javascript could not do this.  Give me 
some urls that you think are convincing, if you think so still.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Michael,

I'm still researching on the web and alot of what I am seeing
is that it is not possible. There is mention that this is strongly
controlled by the browser for security purposes, to prevent
malicious websites from uploading files on the client box
by just doing javascript hacks. Seems to make sense to me,
but if its true, its disappointing since its probably the only
button we can't replace with an image.

Dean

Michael McGrady wrote:

> Dean A. Hoover wrote:
>
>> Michael McGrady wrote:
>>
>>>
>>>>
>>>>
>>> Hi, Dean,
>>>
>>> I am a pretty meat and potatoes kind of genius.  I need to solve one 
>>> thing at a time.  So, right now I am going to stick with only the 
>>> image deal with file uploads.  I have the following which works okay 
>>> with IE but not with Mozilla.
>>>
>>> <form method='get' action='display_none.jsp'> 
>>
>>
>>
>> What does the jsp do? Are you sure that upload is really happening? I 
>> think
>> in order for upload to occur the form has to have 
>> enctype="multipart/form-data"
>> in it, doesn't it? That's what I've always done, but I learned it so 
>> long ago that
>> I just cookbook it now.
>
>
> I am not trying to make that part work right now, Dean.  I am trying 
> to make the image for the browse button work, so I am not worrying 
> about that.  You are right, but that is not the point.  What the jsp 
> does is also irrelevant at this point.  Just call it test.jsp or 
> whatever.  I am merely and simply trying to get an image to work as a 
> browser button in a file upload.  This works in IE but not in Mozilla, 
> etc.  When I get this working in Mozilla, etc. then I will make sure 
> that a submit button works with that.  Then I will worry about the 
> type of the form.
>
> There is no upload happening at this time because I am not even trying 
> to do that now.  Do you understand?  When I get the browse working, 
> then I will worry about the uploading with a submit.
>
> Michael McGrady
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Michael McGrady wrote:
>
>>
>>>
>>>
>> Hi, Dean,
>>
>> I am a pretty meat and potatoes kind of genius.  I need to solve one 
>> thing at a time.  So, right now I am going to stick with only the 
>> image deal with file uploads.  I have the following which works okay 
>> with IE but not with Mozilla.
>>
>> <form method='get' action='display_none.jsp'> 
>
>
> What does the jsp do? Are you sure that upload is really happening? I 
> think
> in order for upload to occur the form has to have 
> enctype="multipart/form-data"
> in it, doesn't it? That's what I've always done, but I learned it so 
> long ago that
> I just cookbook it now.

I am not trying to make that part work right now, Dean.  I am trying to 
make the image for the browse button work, so I am not worrying about 
that.  You are right, but that is not the point.  What the jsp does is 
also irrelevant at this point.  Just call it test.jsp or whatever.  I am 
merely and simply trying to get an image to work as a browser button in 
a file upload.  This works in IE but not in Mozilla, etc.  When I get 
this working in Mozilla, etc. then I will make sure that a submit button 
works with that.  Then I will worry about the type of the form.

There is no upload happening at this time because I am not even trying 
to do that now.  Do you understand?  When I get the browse working, then 
I will worry about the uploading with a submit.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Michael McGrady wrote:

>
>>
>>
> Hi, Dean,
>
> I am a pretty meat and potatoes kind of genius.  I need to solve one 
> thing at a time.  So, right now I am going to stick with only the 
> image deal with file uploads.  I have the following which works okay 
> with IE but not with Mozilla.
>
> <form method='get' action='display_none.jsp'> 

What does the jsp do? Are you sure that upload is really happening? I think
in order for upload to occur the form has to have 
enctype="multipart/form-data"
in it, doesn't it? That's what I've always done, but I learned it so 
long ago that
I just cookbook it now.

>
>        <input type=file
>               name='file1'
>               size='15'
>               class='walter'
>               style='display: none;'>
>        <br>
>
>        <input type='text'
>               name='file2'
>               id='file2'>
>
>        <img src='up.gif'
>             name='brower'
>             id='brower'
>             width='83' height='24' border='0'
>             alt=''
>             align='absmiddle'
>             onclick='document.all.file1.click();
>             document.all.file2.value=document.all.file1.value'
>             onMouseDown='this.src="down.gif"'
>             onMouseUp='this.src="up.gif"'
>             onMouseOut='this.src="up.gif"'>
> </form>
>
> Michaelmcgrady
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Michael,
>
> Sure. Basically I want to do the same thing you are apparently 
> questing for:
> the ability to replace standard browser buttons with images. I have an 
> application
> that I want to retrofit to this, and I have used LookupDispatchAction 
> and other
> approaches in it. I have a wizard (workflow) type of process in it 
> that requires,
> next, previous, finish buttons in it. Cancel buttons are on all of the 
> forms. And,
> I have a file upload page, that was my purpose in launching this 
> thread. I've
> been reading what you've proposed for image buttons, along with what 
> others
> say in general.
>
> I use DynaValidatorForm in most places. One thing I find a little odd 
> is the
> usage of <html:cancel>. There are several forms in my application where
> I don't want to validate if a certain button is pressed but it does 
> not mean
> cancel. I still need to take some action. For example, in the wizard form
> set I spoke of previously, say you are on page 2 of the 5 page set. There
> are three buttons on the form: Previous, Next, and Cancel. If the user
> hits next, I want to validate. If the user hits cancel, I don't want 
> to validate
> so I hit the cancel method. The wierd case is when the user hits 
> Previous.
> The way I have it right now, it validates the current page before 
> going back
> one page. I'd really like it to go the previous page without 
> validating the
> current page. I am reading the source code for Action, DispatchAction,
> and LookupDispatchAction to determine how best to do this.
>
> Anyway, back to your request for teaming up. I'll do what I can. Can you
> share what you've discovered so far?
>
> Dean Hoover
>
Hi, Dean,

I am a pretty meat and potatoes kind of genius.  I need to solve one 
thing at a time.  So, right now I am going to stick with only the image 
deal with file uploads.  I have the following which works okay with IE 
but not with Mozilla.

<form method='get' action='display_none.jsp'>
        <input type=file
               name='file1'
               size='15'
               class='walter'
               style='display: none;'>
        <br>

        <input type='text'
               name='file2'
               id='file2'>

        <img src='up.gif'
             name='brower'
             id='brower'
             width='83' height='24' border='0'
             alt=''
             align='absmiddle'
             onclick='document.all.file1.click();
             document.all.file2.value=document.all.file1.value'
             onMouseDown='this.src="down.gif"'
             onMouseUp='this.src="up.gif"'
             onMouseOut='this.src="up.gif"'>
</form>

Michaelmcgrady



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Michael,

Sure. Basically I want to do the same thing you are apparently questing for:
the ability to replace standard browser buttons with images. I have an 
application
that I want to retrofit to this, and I have used LookupDispatchAction 
and other
approaches in it. I have a wizard (workflow) type of process in it that 
requires,
next, previous, finish buttons in it. Cancel buttons are on all of the 
forms. And,
I have a file upload page, that was my purpose in launching this thread. 
I've
been reading what you've proposed for image buttons, along with what others
say in general.

I use DynaValidatorForm in most places. One thing I find a little odd is the
usage of <html:cancel>. There are several forms in my application where
I don't want to validate if a certain button is pressed but it does not mean
cancel. I still need to take some action. For example, in the wizard form
set I spoke of previously, say you are on page 2 of the 5 page set. There
are three buttons on the form: Previous, Next, and Cancel. If the user
hits next, I want to validate. If the user hits cancel, I don't want to 
validate
so I hit the cancel method. The wierd case is when the user hits Previous.
The way I have it right now, it validates the current page before going back
one page. I'd really like it to go the previous page without validating the
current page. I am reading the source code for Action, DispatchAction,
and LookupDispatchAction to determine how best to do this.

Anyway, back to your request for teaming up. I'll do what I can. Can you
share what you've discovered so far?

Dean Hoover

Michael McGrady wrote:

> Dean A. Hoover wrote:
>
>> Wow, you've been busy. Just getting back to
>> look at what has been suggested. I did a little
>> poking around on the internet and found: 
>
>
>
> If you want to do the button thing with the forms, you first have to 
> learn how to do it with the html and only then take it to struts.  
> Struts pretty much mirrors the html with extras tossed in in that 
> good-old struts way.  So, want to join in on the html hunt?  I am not 
> sure that Erik is still with us (You still with us, Erik?) because he 
> may be satisfied with just altering the button that comes with <input 
> type='file'>.
>
> Michael McGrady
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> Wow, you've been busy. Just getting back to
> look at what has been suggested. I did a little
> poking around on the internet and found: 


If you want to do the button thing with the forms, you first have to 
learn how to do it with the html and only then take it to struts.  
Struts pretty much mirrors the html with extras tossed in in that 
good-old struts way.  So, want to join in on the html hunt?  I am not 
sure that Erik is still with us (You still with us, Erik?) because he 
may be satisfied with just altering the button that comes with <input 
type='file'>.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Wow, you've been busy. Just getting back to
look at what has been suggested. I did a little
poking around on the internet and found:

http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20398679.html

It uses 2 forms to do this. Can't get it to (really) work.
Can't get yours to work either.

I have a little bit of JSP that has worked just fine:

<html:form style="margin-bottom:0;" method="POST" 
enctype="multipart/form-data" action="/UploadAttachment.do">
<html:file property="file"/>
<html:submit value="Attach"/>
</html:form>

Then, I tried tinkering with it, as follows:

<html:form style="margin-bottom:0;" method="POST" 
enctype="multipart/form-data" action="/UploadAttachment.do">
<input type='file' name='browse' style='display: none;'>
<input type='text' name='file'>
<input type='image' onClick='browse.click();file.value=browse.value;' 
src='images/browse_button.gif'>
<html:submit value="Attach"/>
</html:form>

This throws an exception, as follows:

exception

javax.servlet.ServletException: BeanUtils.populate
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
    
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
    
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

org.apache.commons.beanutils.ConversionException: Cannot assign value of 
type 'java.lang.String' to property 'file' of type 
'org.apache.struts.upload.FormFile'
    org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:424)
    
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1733)
    
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
    
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
    
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
    
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
    org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
    
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

Maybe this is just some configuration thing I need to do, don't know yet.

Dean Hoover

Michael McGrady wrote:

> So far I have this, Erik, which works in IE but not in Mozilla.  
> Anyone have any other ideas on this?  I did this before but lost it in 
> a computer crash.
>
> <form method="get" action='boogie-woogie'>
> <input type='file' name='browse' style='display: none;'>
> <input type='text' name='file'>
> <input type='image' onClick='browse.click();file.value=browse.value;' 
> src='browse.gif'>
> </form>
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
So far I have this, Erik, which works in IE but not in Mozilla.  Anyone 
have any other ideas on this?  I did this before but lost it in a 
computer crash.

<form method="get" action='boogie-woogie'>
<input type='file' name='browse' style='display: none;'>
<input type='text' name='file'>
<input type='image' onClick='browse.click();file.value=browse.value;' 
src='browse.gif'>
</form>

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
No worries, Erik!  Let's roll our own.  We can work together on this.  
The key for a starter is using the attribute of style='display:none' in 
the <input type='file'> tag, i.e. <input type=file name=browse 
style="display: none;">

I am looking around for more.  When we get a workable solution for IE, 
it probably won't work for Mozilla, etc. and we can go from there.  Good 
plan, Stan? 

Michael

Erik Weber wrote:

> Well I was mistaken. He did not know of a way to customize the button, 
> only that you can customize the text field with CSS. He made the text 
> field flush with the button and tuned the colors so that the text 
> field and button appeared to be one custom element. But it's still the 
> same old button.
>
> I sure would like to know how to change the font and text of the 
> button to match all the other form buttons I have . . .
>
> Erik
>
>
> Michael McGrady wrote:
>
>> Erik Weber wrote:
>>
>>> I hope one of you guys will post an example when you figure out how 
>>> to do this . . .
>>>
>>> I have a friend who has a site with custom file upload forms (using 
>>> image buttons). Perhaps I will ask him about it . . .
>>>
>>> Erik
>>>
>>>
>>> Michael McGrady wrote:
>>>
>>>> Ergo, research should begin on <input type='"file" disabled="true"> 
>>>> with javascript
>>>>
>>>> Michael
>>>>
>>>> Dean A. Hoover wrote:
>>>>
>>>>> I've been reading some interesting methods for
>>>>> using image buttons on forms in place of the
>>>>> familiar "Submit" style browser generated
>>>>> buttons. There is one automatically generated
>>>>> button that I am still puzzled on how to use
>>>>> an image for it, though. That's the one for
>>>>> do file uploading, as in:
>>>>>
>>>>> <html:form method="POST" enctype="multipart/form-data">
>>>>> <html:file property="theFile"/>
>>>>> <html:submit value="Upload"/>
>>>>> </html:form>
>>>>>
>>>>> Any ideas?
>>>>> Dean Hoover
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>
>> Ask away!  I am in for a solution the easy way every time.  Thanks.
>>
>> Michael
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Erik Weber <er...@mindspring.com>.
Well I was mistaken. He did not know of a way to customize the button, 
only that you can customize the text field with CSS. He made the text 
field flush with the button and tuned the colors so that the text field 
and button appeared to be one custom element. But it's still the same 
old button.

I sure would like to know how to change the font and text of the button 
to match all the other form buttons I have . . .

Erik


Michael McGrady wrote:

> Erik Weber wrote:
>
>> I hope one of you guys will post an example when you figure out how 
>> to do this . . .
>>
>> I have a friend who has a site with custom file upload forms (using 
>> image buttons). Perhaps I will ask him about it . . .
>>
>> Erik
>>
>>
>> Michael McGrady wrote:
>>
>>> Ergo, research should begin on <input type='"file" disabled="true"> 
>>> with javascript
>>>
>>> Michael
>>>
>>> Dean A. Hoover wrote:
>>>
>>>> I've been reading some interesting methods for
>>>> using image buttons on forms in place of the
>>>> familiar "Submit" style browser generated
>>>> buttons. There is one automatically generated
>>>> button that I am still puzzled on how to use
>>>> an image for it, though. That's the one for
>>>> do file uploading, as in:
>>>>
>>>> <html:form method="POST" enctype="multipart/form-data">
>>>> <html:file property="theFile"/>
>>>> <html:submit value="Upload"/>
>>>> </html:form>
>>>>
>>>> Any ideas?
>>>> Dean Hoover
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>
>
> Ask away!  I am in for a solution the easy way every time.  Thanks.
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Erik Weber wrote:

> I hope one of you guys will post an example when you figure out how to 
> do this . . .
>
> I have a friend who has a site with custom file upload forms (using 
> image buttons). Perhaps I will ask him about it . . .
>
> Erik
>
>
> Michael McGrady wrote:
>
>> Ergo, research should begin on <input type='"file" disabled="true"> 
>> with javascript
>>
>> Michael
>>
>> Dean A. Hoover wrote:
>>
>>> I've been reading some interesting methods for
>>> using image buttons on forms in place of the
>>> familiar "Submit" style browser generated
>>> buttons. There is one automatically generated
>>> button that I am still puzzled on how to use
>>> an image for it, though. That's the one for
>>> do file uploading, as in:
>>>
>>> <html:form method="POST" enctype="multipart/form-data">
>>> <html:file property="theFile"/>
>>> <html:submit value="Upload"/>
>>> </html:form>
>>>
>>> Any ideas?
>>> Dean Hoover
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>

Ask away!  I am in for a solution the easy way every time.  Thanks.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Erik Weber <er...@mindspring.com>.
I hope one of you guys will post an example when you figure out how to 
do this . . .

I have a friend who has a site with custom file upload forms (using 
image buttons). Perhaps I will ask him about it . . .

Erik


Michael McGrady wrote:

> Ergo, research should begin on <input type='"file" disabled="true"> 
> with javascript
>
> Michael
>
> Dean A. Hoover wrote:
>
>> I've been reading some interesting methods for
>> using image buttons on forms in place of the
>> familiar "Submit" style browser generated
>> buttons. There is one automatically generated
>> button that I am still puzzled on how to use
>> an image for it, though. That's the one for
>> do file uploading, as in:
>>
>> <html:form method="POST" enctype="multipart/form-data">
>> <html:file property="theFile"/>
>> <html:submit value="Upload"/>
>> </html:form>
>>
>> Any ideas?
>> Dean Hoover
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Ergo, research should begin on <input type='"file" disabled="true"> with 
javascript

Michael

Dean A. Hoover wrote:

> I've been reading some interesting methods for
> using image buttons on forms in place of the
> familiar "Submit" style browser generated
> buttons. There is one automatically generated
> button that I am still puzzled on how to use
> an image for it, though. That's the one for
> do file uploading, as in:
>
> <html:form method="POST" enctype="multipart/form-data">
> <html:file property="theFile"/>
> <html:submit value="Upload"/>
> </html:form>
>
> Any ideas?
> Dean Hoover
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Dean A. Hoover wrote:

> I've been reading some interesting methods for
> using image buttons on forms in place of the
> familiar "Submit" style browser generated
> buttons. There is one automatically generated
> button that I am still puzzled on how to use
> an image for it, though. That's the one for
> do file uploading, as in:
>
> <html:form method="POST" enctype="multipart/form-data">
> <html:file property="theFile"/>
> <html:submit value="Upload"/>
> </html:form>
>
> Any ideas?
> Dean Hoover
>

As a start, here is the FileUpload object created by <input 
type="file">: Hope this goest through, but, if not, then see 
http://www.w3schools.com/htmldom/dom_obj_fileupload.asp

Michael McGrady

<pre>


  HTML DOM FileUpload Object

previous <http://www.w3schools.com/htmldom/dom_obj_event.asp> next 
<http://www.w3schools.com/htmldom/dom_obj_form.asp>
------------------------------------------------------------------------


    FileUpload Object

For each instance of an HTML <input type="file"> tag on a form, a 
FileUpload object is created.

All FileUpload objects are stored in the elements array of the 
corresponding form. You can access a FileUpload object by indexing this 
array - either by number (0 represents the first element in a form) or 
by using the value of the name attribute.

The FileUpload object's properties, methods, and events are described below:

*N*: Netscape (including Mozilla when N6 or higher), *IE*: Internet 
Explorer, *W3C*: World Wide Web Consortium (Internet Standard)


      Properties

Syntax: object.property_name

Property 	Description 	N 	IE  	W3C
accept 	Sets or returns a list of content types that the server that 
processes this form will handle correct 	  	- 	Yes
accessKey 	Sets or returns the keyboard key to access the FileUpload 
object 	  	4 	Yes
align 	Sets or returns the alignment of the FileUpload object according 
to the surrounding text 	  	- 	Yes
alt 	Sets or returns an alternate text to display if the browser does 
not support <input type="file"> 	  	- 	Yes
defaultValue 	Sets or returns the initial value of the FileUpload 
object 	3 	4 	Yes
disabled 	Sets or returns whether or not the FileUpload object should be 
disabled 	  	4 	Yes
form 	Returns a reference to the form that contains the FileUpload 
object 	3 	4 	Yes
id 	Sets or returns the id of the FileUpload object (In IE 4 this 
property is read-only) 	  	4 	No
name 	Sets or returns the name of the FileUpload object 	3 	4 	Yes
tabIndex 	Sets or returns the index that defines the tab order for the 
FileUpload object 	  	4 	Yes
type 	Returns the type of the form element. For a FileUpload object it 
will be "file" 	3 	4 	Yes
value 	Returns the file name of the FileUpload object after the text is 
set by user input 	3 	4 	Yes


      Methods

Syntax: object.method_name()

Method 	Description 	N 	IE 	W3C
blur() 	Removes focus from the FileUpload object 	3 	4 	Yes
click() 	Simulates a mouse-click on the FileUpload object 	  	4 	No
focus() 	Gives focus to the FileUpload object 	3 	4 	Yes
select() 	Selects the FileUpload object 	  	4 	Yes


      Events

Syntax: object.event_name="someJavaScriptCode"

Event 	Description 	NN 	IE 	W3C
onBlur 	Executes some code when the FileUpload object loses focus 	3 	4 	 
onClick 	Executes some code when the FileUpload object gets a mouse 
click 	3 	4 	 
onFocus 	Executes some code when the FileUpload object gets focus 	3 	4 	 
onSelectStart 	Executes some code when the FileUpload object gets 
selected 	  	4 	 


</pre>

Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
  HTML DOM FileUpload Object

previous <http://www.w3schools.com/htmldom/dom_obj_event.asp> next 
<http://www.w3schools.com/htmldom/dom_obj_form.asp>
------------------------------------------------------------------------


    FileUpload Object

For each instance of an HTML <input type="file"> tag on a form, a 
FileUpload object is created.

All FileUpload objects are stored in the elements array of the 
corresponding form. You can access a FileUpload object by indexing this 
array - either by number (0 represents the first element in a form) or 
by using the value of the name attribute.

The FileUpload object's properties, methods, and events are described below:

*N*: Netscape (including Mozilla when N6 or higher), *IE*: Internet 
Explorer, *W3C*: World Wide Web Consortium (Internet Standard)


      Properties

Syntax: object.property_name

Property 	Description 	N 	IE  	W3C
accept 	Sets or returns a list of content types that the server that 
processes this form will handle correct 	  	- 	Yes
accessKey 	Sets or returns the keyboard key to access the FileUpload 
object 	  	4 	Yes
align 	Sets or returns the alignment of the FileUpload object according 
to the surrounding text 	  	- 	Yes
alt 	Sets or returns an alternate text to display if the browser does 
not support <input type="file"> 	  	- 	Yes
defaultValue 	Sets or returns the initial value of the FileUpload 
object 	3 	4 	Yes
disabled 	Sets or returns whether or not the FileUpload object should be 
disabled 	  	4 	Yes
form 	Returns a reference to the form that contains the FileUpload 
object 	3 	4 	Yes
id 	Sets or returns the id of the FileUpload object (In IE 4 this 
property is read-only) 	  	4 	No
name 	Sets or returns the name of the FileUpload object 	3 	4 	Yes
tabIndex 	Sets or returns the index that defines the tab order for the 
FileUpload object 	  	4 	Yes
type 	Returns the type of the form element. For a FileUpload object it 
will be "file" 	3 	4 	Yes
value 	Returns the file name of the FileUpload object after the text is 
set by user input 	3 	4 	Yes


      Methods

Syntax: object.method_name()

Method 	Description 	N 	IE 	W3C
blur() 	Removes focus from the FileUpload object 	3 	4 	Yes
click() 	Simulates a mouse-click on the FileUpload object 	  	4 	No
focus() 	Gives focus to the FileUpload object 	3 	4 	Yes
select() 	Selects the FileUpload object 	  	4 	Yes


      Events

Syntax: object.event_name="someJavaScriptCode"

Event 	Description 	NN 	IE 	W3C
onBlur 	Executes some code when the FileUpload object loses focus 	3 	4 	 
onClick 	Executes some code when the FileUpload object gets a mouse 
click 	3 	4 	 
onFocus 	Executes some code when the FileUpload object gets focus 	3 	4 	 
onSelectStart 	Executes some code when the FileUpload object gets 
selected 	  	4



Michael McGrady wrote:

> One of the problems you run into with this is that there are differing 
> behaviors between IE and the other browsers.
>
> Michael McGrady wrote:
>
>> Leandro Melo wrote:
>>
>>> I'm no expert here, but i think you're gonna have to
>>> deal with the tradicional and ordinary file button as
>>> it comes. In other words, i don't think it's possible
>>> to use an image for this button.
>>> That's not because of struts, it's how the browsers
>>> implement thier html.
>>>
>>>
>>> --- "Dean A. Hoover" <dh...@rochester.rr.com>
>>> escreveu: 
>>>
>>>> I've been reading some interesting methods for
>>>> using image buttons on forms in place of the
>>>> familiar "Submit" style browser generated
>>>> buttons. There is one automatically generated
>>>> button that I am still puzzled on how to use
>>>> an image for it, though. That's the one for
>>>> do file uploading, as in:
>>>>
>>>> <html:form method="POST"
>>>> enctype="multipart/form-data">
>>>> <html:file property="theFile"/>
>>>> <html:submit value="Upload"/>
>>>> </html:form>
>>>>
>>>> Any ideas?
>>>> Dean Hoover
>>>>
>>>>
>>>>   
>>>
>>>
>>
>> THIS CAN BE DONE.  You have to shut off the automagically button and 
>> then use another image for a button via JavaScript.  I am going to do 
>> this too, so let's cooperate on it.
>>
>> Michael McGrady
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
One of the problems you run into with this is that there are differing 
behaviors between IE and the other browsers.

Michael McGrady wrote:

> Leandro Melo wrote:
>
>> I'm no expert here, but i think you're gonna have to
>> deal with the tradicional and ordinary file button as
>> it comes. In other words, i don't think it's possible
>> to use an image for this button.
>> That's not because of struts, it's how the browsers
>> implement thier html.
>>
>>
>> --- "Dean A. Hoover" <dh...@rochester.rr.com>
>> escreveu:  
>>
>>> I've been reading some interesting methods for
>>> using image buttons on forms in place of the
>>> familiar "Submit" style browser generated
>>> buttons. There is one automatically generated
>>> button that I am still puzzled on how to use
>>> an image for it, though. That's the one for
>>> do file uploading, as in:
>>>
>>> <html:form method="POST"
>>> enctype="multipart/form-data">
>>> <html:file property="theFile"/>
>>> <html:submit value="Upload"/>
>>> </html:form>
>>>
>>> Any ideas?
>>> Dean Hoover
>>>
>>>
>>>   
>>
>
> THIS CAN BE DONE.  You have to shut off the automagically button and 
> then use another image for a button via JavaScript.  I am going to do 
> this too, so let's cooperate on it.
>
> Michael McGrady
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Leandro Melo wrote:

>I'm no expert here, but i think you're gonna have to
>deal with the tradicional and ordinary file button as
>it comes. In other words, i don't think it's possible
>to use an image for this button.
>That's not because of struts, it's how the browsers
>implement thier html.
>
>
> --- "Dean A. Hoover" <dh...@rochester.rr.com>
>escreveu: 
>  
>
>>I've been reading some interesting methods for
>>using image buttons on forms in place of the
>>familiar "Submit" style browser generated
>>buttons. There is one automatically generated
>>button that I am still puzzled on how to use
>>an image for it, though. That's the one for
>>do file uploading, as in:
>>
>><html:form method="POST"
>>enctype="multipart/form-data">
>><html:file property="theFile"/>
>><html:submit value="Upload"/>
>></html:form>
>>
>>Any ideas?
>>Dean Hoover
>>
>>
>>    
>>

THIS CAN BE DONE.  You have to shut off the automagically button and 
then use another image for a button via JavaScript.  I am going to do 
this too, so let's cooperate on it.

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: image button for file upload

Posted by Leandro Melo <lt...@yahoo.com.br>.
I'm no expert here, but i think you're gonna have to
deal with the tradicional and ordinary file button as
it comes. In other words, i don't think it's possible
to use an image for this button.
That's not because of struts, it's how the browsers
implement thier html.


 --- "Dean A. Hoover" <dh...@rochester.rr.com>
escreveu: 
> I've been reading some interesting methods for
> using image buttons on forms in place of the
> familiar "Submit" style browser generated
> buttons. There is one automatically generated
> button that I am still puzzled on how to use
> an image for it, though. That's the one for
> do file uploading, as in:
> 
> <html:form method="POST"
> enctype="multipart/form-data">
> <html:file property="theFile"/>
> <html:submit value="Upload"/>
> </html:form>
> 
> Any ideas?
> Dean Hoover
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
>  


	
	
		
_______________________________________________________
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org