[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FormControl.java,1.30,1.31
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-10-31 04:55:04
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv14865/src/com/meterware/httpunit
Modified Files:
FormControl.java
Log Message:
bug #618140: implement JavaScript support for FileSubmit control
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- FormControl.java 22 Oct 2002 20:15:34 -0000 1.30
+++ FormControl.java 31 Oct 2002 04:54:58 -0000 1.31
@@ -730,6 +730,24 @@
private UploadFileSpec _fileToUpload;
+ protected FormControl.Scriptable newScriptable() {
+ return new Scriptable();
+ }
+
+
+ class Scriptable extends FormControl.Scriptable {
+
+ public Object get( String propertyName ) {
+ if (propertyName.equalsIgnoreCase( "value" )) {
+ return getSelectedName();
+ } else {
+ return super.get( propertyName );
+ }
+ }
+
+
+ }
+
public FileSubmitFormControl( WebForm form, Node node ) {
super( form, node );
}
@@ -747,7 +765,12 @@
* Returns the name of the selected file, if any.
*/
public String[] getValues() {
- return new String[] { _fileToUpload == null ? "" : _fileToUpload.getFileName() };
+ return new String[] { getSelectedName() };
+ }
+
+
+ private String getSelectedName() {
+ return _fileToUpload == null ? "" : _fileToUpload.getFileName();
}
|