This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Form is not submitting when I use the TAB for navigation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Form is not submitting when I use the TAB for navigation" Watch "Form is not submitting when I use the TAB for navigation" New topic

Form is not submitting when I use the TAB for navigation

G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
Hi All,
I have a problem while submitting the form through tab navigation.

in a form I have browse button(created using <input type="file"> tag) but this is hidden by a customized browse button as shown in the following code.

<form id="uploadform" name ="uploadform" method="post" enctype="multipart/form-data" action="<e:txDir />/SaveImageEvent"

<input type="file" class="hide" id="datafileLogo" name="datafileLogo"
<a href="javascript:repReportOptions.openFileWindow('datafileLogo')" id="likfileLogo"><img src="/browse_btn.gif" border="disabled"/></a>

//this method is used to open the file selection window on clicking the image above Browse image.
this.openFileWindow = function(objectId)
var flvar = document.getElementById(objectId);;

//this save image method is called when the user selects the image from the file window( on onChange) .Here I have to use the TAB navigation only to select and submit the selected file.
this.saveImage = function(imagePrefix,imageName,displayImageFrame)
var fileName = document.getElementById(imageName).value;
var fileType = fileName.substr(fileName.lastIndexOf("."));
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var thefile = fileSystem.getFile(fileName);
var size = thefile.size;

if(((fileType == ".gif") || (fileType == ".GIF")) && (size <= 1048576))
document.uploadform.imageType.value = fileType;
document.uploadform.imagePrefix.value = imagePrefix;
document.uploadform.fileOperation.value= 'saveImage'; = displayImageFrame;
document.uploadform.imagefileName.value = imageName;
util.alert("Images must be .gif files less than 1MB is size. Click the information icon in the coverpage options section for more information.");


Here the problem is document.uploadform.submit(); line is not executing in the above saveImage () method(when I use TAB for selecting and submit the selected file from the file window) and all statements above the document.uploadform.submit() statement are executing properly.

When I use Mouse everything is working file. Please suggest a solution as this is killing me for the past 3 days.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

Please UseCodeTags.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
I hope you are using that code with IE only and with low security levels.

G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
Yes Eric. I am using IE only still I am not understanding your comment "low security levels".Could you please elaborate it and I would appreciate if you provide me the solution. Thanks
I agree. Here's the link:
subject: Form is not submitting when I use the TAB for navigation
Similar Threads
Form is not submitting on TAB navigation
datepicker problem
How to update a image using servlet?
How to get open or save dialog in struts.
jQuery UI tabs not loading in the same tab