Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CheckBoxItem using datapath not noticed in Form.valuesHaveChanged()

    Hi,

    Something weird is going on, when using a custom CheckBoxItem with a specific dataPath, the Form doesn't 'recognize' that a change has been done.

    When I call Form.valuesHaveChanged() it always returns false; to be sure, I added 'rememberValues' to the form (but that doesn't change anything).

    Test case is pretty simple: just change the value of the checkBox from false to true and hit the save button.

    FYI, when using a datasource I have the same issue.

    Something else I have noticed (with my datasource) but where the test case is a bit elaborate to setup, is that this boolean value DOESN'T show up in the changedValues part of the dsRequest when updating (certainly not in the DEV console). My datasource uses dropExtraFields="true" and sparseUpdates="true". As I said, this test case will be hard to setup, but maybe solving the one I logged here will solve this issue as well (fingers crossed).

    SmartClient Version: SC_SNAPSHOT-2011-03-17/EVAL Deployment
    FireFox 3.6.15

    Code:
    public class Standalone implements EntryPoint {
    		
    	private static Canvas masterPanel = null;
    	
    	public void onModuleLoad() {
    		 
    		//masterPanel should be a Layout
    		masterPanel = new Canvas(); 
    		masterPanel.setHeight100();
    		masterPanel.setWidth100();
    		masterPanel.setStyleName("pageBackground"); //background style from skin
    		
    		masterPanel.addChild(testCase11());
    		masterPanel.draw();	
    	}
    
    
    public VLayout testCase11() {  
    		 
        	VLayout test = new VLayout();
        	test.setWidth100();
        	test.setHeight100();
    		 			  
    	JavaScriptObject jsObject = JSOHelper.createObject();
    	JSOHelper.setAttribute(jsObject, "booleanValue", Boolean.FALSE);
    	    	    
    	MyCheckBoxEditor editor = new MyCheckBoxEditor();
    	editor.setName("checkBoxField1");
    	editor.setDataPath("checkBoxField1/booleanValue");   
    
    	final DynamicForm form = new DynamicForm();   
    	form.setHeight(170);   
    	form.setWidth(500);
    	form.setValue("checkBoxField1", jsObject);
    	form.setFields(editor);
    	form.rememberValues();//just to be sure
    	    
    	Button saveBtn = new Button("save");
    	saveBtn.addClickHandler(new ClickHandler() {
    			
    	public void onClick(ClickEvent event) {
    		if(form.valuesHaveChanged()){
    			form.saveData(new DSCallback() {
    						
    			public void execute(DSResponse response, Object rawData, DSRequest request) {
    							
    					}
    				});	
    		}else{
    			SC.say("values haven't changed!?!");
    		}
    				
    				
    			}
    		});
    
    	    test.addMember(form);
    	    test.addMember(saveBtn);
    	    return test;
    	}
    
    }

    #2
    We've added some logic to resolve this issue. Please try with the next nightly build and let us know if you still see problems

    Thanks
    Isomorphic Software

    Comment


      #3
      Just tried with my standalone test case (posted above) and issue is still there;

      SC_SNAPSHOT-2011-03-21/EVAL Deployment
      FireFox 3.6.15

      Comment


        #4
        Yes - the fix didn't make it into the March 21 build and we haven't posted a nightly containing it yet. Should be in the next nightly.

        Comment

        Working...
        X