Hybrid View

  1. #1
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default [FIXED] ComboBox issue setValue to hidden field

    [FIXED] ComboBox issue setValue to hidden field


    when set a value to combobox the hidden field don't received the value.. I need select the item in combobox to my hidden field receveid the value.. the problem:

    my form have a combobox that have the country that the person live.. when the user go update your profile.. I need reset this field and do the user to select you country again...

    Code:
    		ListStore<TestModel> store = new ListStore<TestModel>();
    
    		TestModel model = new TestModel();
    		model.setCodigo(1);
    		model.setNome("name 1");
    
    		TestModel model1 = new TestModel();
    		model1.setCodigo(2);
    		model1.setNome("name 2");
    
    		store.add(model);
    		store.add(model1);
    
    		FormPanel form = new FormPanel();
    
    		ComboBox<TestModel> combo = new ComboBox<TestModel>();
    		combo.setStore(store);
    		combo.setFieldLabel("xxx");
    		combo.setDisplayField("nome");
    		combo.setValueField("codigo");
    		combo.setName("comboBox");
    		combo.setValue(model);
    
    		form.add(combo);
    
    		RootPanel.get().add(form);
    TestModel.java
    Code:
    public class TestModel extends BaseModel {
    
    	public Integer getCodigo() {
    		return get("codigo");
    	}
    
    	public String getNome() {
    		return get("nome");
    	}
    
    	public void setCodigo(Integer codigo) {
    		set("codigo", codigo);
    	}
    
    	public void setNome(String nome) {
    		set("nome", nome);
    	}
    
    }

  2. #2
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default


    wait.. setValueField() ???? I will test

  3. #3
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default


    add to the code, and you can see that the hidden field continue with the value empty..

    Code:
    combo.setValueField(model.getCodigo().toString());

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,703
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    Thanks for reporting.

  5. #5
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default


    In combobox...

    Code:
    private String loadingText = "Loading...";
    ????

    in properties..

    Code:
    # ComboBox
    comboBox_loading=Loading...

  6. #6
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default


    to solve this problem....


    Code:
        if (valueField != null) {
          hiddenInput = Document.get().createHiddenInputElement().cast();
          hiddenInput.setName(getName() + "-hidden");
          parent.appendChild(hiddenInput);
          updateHiddenValue(); // add this line or use other logic
        }

  7. #7
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    0
    fother is on a distinguished road

      0  

    Default


    you test with all condition that I post?

  8. #8
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,703
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    I tested it and it works.