wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes input type=file 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 "input type=file" Watch "input type=file" New topic
Author

input type=file

ALaxmi Shankaran
Greenhorn

Joined: Feb 23, 2004
Posts: 26
I am facing one problem one field in my jsp is of the input type - file
onblur of that i have written one js function and checking for some validation
and then returning true/false accordingly but in this case my page get submitted even though
the function returns false can anybody has solution?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
code?
ALaxmi Shankaran
Greenhorn

Joined: Feb 23, 2004
Posts: 26
function validate(){
if((document.all.filname.value=="") || (document.all.filname.value==null)){
alert("Please enter filename");
return false;
}
else{
//code to submit the form
return true;
}
}
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Try this:

 
 
subject: input type=file
 
Similar Threads
executing a javascript function from a servlet
how to disable if one or more check boxes selected
Reading parameter from JSP page
error in javascript when doing form.action
input type=image with JS