Slattery, Tim - BLS 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>



Absolutely right, this won't work in Mozilla. IE allows this kind of addressing, but it's non-standard. Mozilla hews to the standards always. This will work on both browsers:

<script language="javascript>
function getFile()
{
     o = document.getElementById("browse");
     0.click();
     document.getElementById("file").value = o.value;
}
</script>
...
<form method="get" action="boogie=woogie">
<input type="file" name="browse" id="browse" style="display:none">
<input type="text" name="file" id="file">
<input type="image" onClick="getFile()" src="browse.gif">
</form>


-- Tim Slattery [EMAIL PROTECTED]


Also, Tim, I get the following

If the file in the "browse" text panel is "C:\jakarta-service.log", then:

As a result, the value being sent with file is not really the name of the file, but, rather, the location of the file combined with the x and y coordinates of the place the button was clicked. I could do a work around with this in the model. But that particular relationship between the view and the model should be, I think, avoided if at all possible. Clearly you know how to do this. I don't see what you are doing, because I am abysmally ignorant of JavaScript.

RESULTS FORM 1: (standard results)
[URL]/tim.jsp?browse=jakarta-service.log&submit.x=16&submit.y=6

RESULTS FORM 2: (present results)
[URL]/tim.jsp?browse=jakarta-service.log&file=C%3A%5Cjakarta-service.log&x=15&y=5

FORMS

   <script language="javascript>"
   function getFile()
   {
         o = document.getElementById("browse");
         0.click();
         document.getElementById("file").value = o.value;
   }
   </script>
   FORM 1
   <form method="get" action="tim.jsp" enctype="multi-part/form">
       <input type="file" name="browse" id="browse" style="display:none">
       <input type="text" name="file" id="file">
       <input type="image" onClick="getFile()" src="submit.gif">
   </form>
   FORM 2
   <form method="get" action="tim.jsp" enctype="multi-part/form">
       <input type="file" name="browse">
       <input type="image" src="submit">
   </form>




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to