Results 1 to 10 of 24

Thread: [FIXED] ComboBox issue setValue to hidden field

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    Default [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

    Default

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

  3. #3
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    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
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Thanks for reporting.

  5. #5
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    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

    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

    Default

    you test with all condition that I post?

  8. #8
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    I tested it and it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •