1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    drain is on a distinguished road

      0  

    Question FormPanel isValid, Multifield, and AdapterFields

    FormPanel isValid, Multifield, and AdapterFields


    Hey All,

    How can i turn off validation for adapter fields? I have a formpanel with other buttons and fill items inserted as adapter fields within a Multifield and this is causing NullPointer's when I call formPanel.isValid().

    Any ideas or is this a bug?

    Thanks,
    Adrian

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    post some code - as it shouldn't - adapterfield overrides validateValue(String value)
    {
    return true;
    }

  3. #3
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    drain is on a distinguished road

      0  

    Default


    Sure here is some test code that causes the error.

    thanks.

    Code:
    package com.mycompany.project.client;
    
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.MessageBox;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.AdapterField;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.extjs.gxt.ui.client.widget.form.MultiField;
    import com.extjs.gxt.ui.client.widget.form.TextField;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class GXTTester implements EntryPoint {
    
    	public void onModuleLoad() {
    
    		
    		final FormPanel form = new FormPanel();
    
    		MultiField multi = new MultiField();
    		multi.setFieldLabel("Enter Text");
    		multi.setSpacing(20);
    	
    		TextField text = new TextField();
    		
    		
    		Button button = new Button("Click Me");
    		button.addSelectionListener(new SelectionListener<ComponentEvent>(){
    			@Override
    			public void componentSelected(ComponentEvent ce)
    			{
    				if(form.isValid()) //NPE thrown here
    				{
    					MessageBox.alert("Alert", "valid", null);
    				}else
    				{
    					MessageBox.alert("Alert", "not valid", null);
    				}
    			}
    		});
    		
    		AdapterField buttonAdapter = new AdapterField(button);
    		
    		multi.add(text);
    		multi.add(buttonAdapter);
    		
    		form.add(multi);
    	
    		RootPanel.get().add(form);
    		
    	}
    }
    and stacktrace

    Code:
    [ERROR] Uncaught exception escaped
    java.lang.NullPointerException: null
    	at com.extjs.gxt.ui.client.widget.form.Field.getRawValue(Field.java:324)
    	at com.extjs.gxt.ui.client.widget.form.Field.isValid(Field.java:418)
    	at com.extjs.gxt.ui.client.widget.form.MultiField.isValid(MultiField.java:136)
    	at com.extjs.gxt.ui.client.widget.form.FormPanel.isValid(FormPanel.java:218)
    	at com.mycompany.project.client.GXTTester$1.componentSelected(GXTTester.java:37)
    	at com.extjs.gxt.ui.client.event.SelectionListener.handleEvent(SelectionListener.java:20)
    	at com.extjs.gxt.ui.client.event.SelectionListener.handleEvent(SelectionListener.java:1)
    	at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:74)
    	at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:423)
    	at com.extjs.gxt.ui.client.widget.button.Button.onClick(Button.java:460)
    	at com.extjs.gxt.ui.client.widget.button.Button.onComponentEvent(Button.java:234)
    	at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:662)
    	at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
    	at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1287)
    	at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1255)
    	at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    	at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
    	at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
    	at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
    	at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
    	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
    	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
    	at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
    	at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
    	at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    Seems a bug exists, when adding an adapterfield to a multifield.

    But your approach is wrong.

    If you need a button added, then you should add the button to the formpanel.getButtonBar().add(button);

  5. #5
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    drain is on a distinguished road

      0  

    Default


    gslender: thanks for the reply. I am adding rows to the form dynamically and these buttons are used for adding/removing rows. These aren't the Submit/Back buttons. Should i submit this as a bug? I'm new to extjs, not sure how that is done.

    thanks

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi