pkt1583 / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

TextField validation throws HostedModeException for "file" type fields #267

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a TextField -> TextField testTF = new TextField();
2. Set it to Type "file" -> testTF.setInputType("file");
3. Require non-empty value -> testTF.setAllowBlank(false);
4. validate it -> testTF.validate();

What is the expected output? What do you see instead?
If no filename has been entered, the following Exception is thrown when
validating:

com.google.gwt.dev.shell.HostedModeException:
invokeNativeBoolean(@com.gwtext.client.widgets.form.Field::validate()):
JavaScript undefined, expected java.lang.Boolean
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:101)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:185)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:
49)
    at com.gwtext.client.widgets.form.Field.validate(Field.java:191)

What version of the product are you using? On what operating system?
gwt-ext 2.0
extJS 2.0.1
GWT 1.4.61
Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by pgil%agn...@gtempaccount.com on 6 Mar 2008 at 10:59

GoogleCodeExporter commented 8 years ago
Can you try using GWT-Ext 2.0.2 with Ext 2.0.2?

The following code works as expected.

TextField testTF = new TextField();
testTF.setInputType("file");
testTF.setAllowBlank(false);
boolean valid = testTF.validate();

Original comment by sanjiv.j...@gmail.com on 8 Mar 2008 at 3:25

GoogleCodeExporter commented 8 years ago
I've tried upgrading to GWT-Ext 2.0.2 and Ext 2.0.2. It doesn't work either.

Original comment by pgil%agn...@gtempaccount.com on 10 Mar 2008 at 2:56

GoogleCodeExporter commented 8 years ago
Can you send the entire code for the test as a module class.

Original comment by sanjiv.j...@gmail.com on 10 Mar 2008 at 3:14

GoogleCodeExporter commented 8 years ago
The following class throws the mentioned exception upon click on 
'validateButton':

import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.TextField;
import com.gwtext.client.widgets.layout.VerticalLayout;
import com.gwtext.client.core.EventObject;

public class TestTextFieldValidationPanel extends Panel{

    public TestTextFieldValidationPanel(){
        setLayout(new VerticalLayout(15));

        final TextField fileTextField = new TextField();
        fileTextField.setInputType("file");
        fileTextField.setAllowBlank(false);

        Button validateButton = new Button("Validate",new ButtonListenerAdapter(){
            public void onClick(Button button, EventObject e){
                fileTextField.validate();
            }
        });

        add(fileTextField);
        add(validateButton);
    }
}

Original comment by pgil%agn...@gtempaccount.com on 24 Mar 2008 at 7:52

GoogleCodeExporter commented 8 years ago
Maybe it should be set to priority-high. ;)

Original comment by virid...@gmail.com on 5 Aug 2008 at 6:53

GoogleCodeExporter commented 8 years ago
OK guys,

Until the bug is fixed, here is how I fixed the problem by patching GWT. If you 
need the patched file, or need 
further assistance, contact me at viridium at gmail.

@ Viridium.ro: http://www.viridium.ro/2008/gwt-gwt-ext-and-mimemultipart-forms/

Mihai

Original comment by virid...@gmail.com on 5 Aug 2008 at 8:03

GoogleCodeExporter commented 8 years ago
I can't replicate this problem!
This is what I have:

    final Panel form = new Panel();
    form.setLayout(new FormLayout());
    final TextField tf = new TextField("First");
    tf.setId("first");
    tf.setInputType("file");
    tf.setAllowBlank(false);
    form.add(tf);

    TextField tf2 = new TextField("Second");
    tf2.setId("second");
    form.add(tf2);

    form.addButton(new Button("Validate First", new ButtonListenerAdapter(){
      public void onClick(Button button, EventObject e) {
        tf.validate();
      }
    }));

Original comment by mlim1...@gmail.com on 9 Sep 2008 at 4:48

GoogleCodeExporter commented 8 years ago
as is discussed here:
http://gwt-ext.com/forum/viewtopic.php?f=5&t=161&p=1801&hilit=form+submit+respon
se#p1801

sjivan suggests this issue be about receiving server response for file upload 
using
FormListener. However, this issue seems discussing a different issue. 

Original comment by jasonzha...@gmail.com on 15 Sep 2008 at 4:37