Hello,
I am using file tag works fine if a file is selected using browse button or the
path is entered manually. But if file name/path is rubbish the form is not
submitted at all, nothing happens.
1. How do I control this - show error like invalid filename?
2. Or else how to disable manual entry, only browse button works???????
3. I tried javascript options like onKeypress to reset value to null - didnt
help.
Please help.
Regards,
Srikanth
< s:form action = "/createEnt2.do" method = "POST" enctype =
"multipart/form-data" validate = "true" > s:form action = "/createEnt2.do"
method = "POST" enctype = "multipart/form-data" validate = "true" >
< s:file name = "dc" id = "dc" accept = "text/*" label = "Digital
Certificate" onkeydown = "return reset1();" /> < s:file name = "dc" id
= "dc" accept = "text/*" label = "Digital Certificate" onkeydown = "return
reset1();" />
</ </ s:form >
</ </ s:form >
function reset1() reset1()
{
var thisForm = document.forms[0];
thisForm.dc.value = 'all' ;
window.alert( "sfds" ); thisForm = document.forms[0];
thisForm.dc.value = 'all' ;
window.alert( "sfds" ); 'all' ;
window.alert( "sfds" ); "sfds" );
}
Java ###########################
private File dc ;
private String uploadContentType ; //The content type of the file private File
dc ;
private String uploadContentType ; //The content type of the file private
String uploadContentType ; //The content type of the file
private String uploadFileName ; //The uploaded file name
/** private String uploadFileName ; //The uploaded file name
/** /**
* @return the dc * @return the dc
*/ */
public File getDc() {
return dc ;
}
/** public File getDc() {
return dc ;
}
/** return dc ;
}
/** /**
* @param dc the dc to set * @param dc the dc to set
*/ */
public void setDc(File dc) {
this . dc = dc;
}
/** public void setDc(File dc) {
this . dc = dc;
}
/** this . dc = dc;
}
/** /**
* @return the uploadContentType * @return the uploadContentType
*/ */
public String getUploadContentType() {
return uploadContentType ;
}
/** public String getUploadContentType() {
return uploadContentType ;
}
/** return uploadContentType ;
}
/** /**
* @param uploadContentType the uploadContentType to set * @param
uploadContentType the uploadContentType to set
*/ */
public void setUploadContentType(String uploadContentType) {
this . uploadContentType = uploadContentType;
}
/** public void setUploadContentType(String uploadContentType) {
this . uploadContentType = uploadContentType;
}
/** this . uploadContentType = uploadContentType;
}
/** /**
* @return the uploadFileName * @return the uploadFileName
*/ */
public String getUploadFileName() {
return uploadFileName ;
}
/** public String getUploadFileName() {
return uploadFileName ;
}
/** return uploadFileName ;
}
/** /**
* @param uploadFileName the uploadFileName to set * @param uploadFileName the
uploadFileName to set
*/ */
public void setUploadFileName(String uploadFileName) {
this . uploadFileName = uploadFileName;
} public void setUploadFileName(String uploadFileName) {
this . uploadFileName = uploadFileName;
} this . uploadFileName = uploadFileName;
}