Announcement

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

    multiple selectItem getValues doesn't work with validation

    The following code shows that if you select multiple values for a select item and validate, getValues returns an empty array. If you don't validate, it returns the correct values.
    Code:
    	public void onModuleLoad() {
    		IntegerItem hours = new IntegerItem();
    		hours.setTitle(UI.getLabelTitle("Total Hours"));
    		hours.setWidth(50);
    		final SelectItem select = new SelectItem();
    		select.setWidth(250);
    		select.setTitle(UI.getLabelTitle("Competencies"));
    		select.setMultiple(true);
    		select.setMultipleAppearance(MultipleAppearance.PICKLIST);
    		select.setAddUnknownValues(false);
    		LinkedHashMap<String,String> map = new LinkedHashMap<String,String>();
    		map.put("v1","Option 1");
    		map.put("v2","Option 2");
    		map.put("v3","Option 3");
    		select.setValueMap(map);
    		final DynamicForm form = new DynamicForm();
    		form.setItems(hours,select);
    		
    		IButton save = new IButton("save");
    		save.setTitle("Save");
    		save.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				if (form.validate())
    					SC.say("n="+select.getValues().length);
    			}
    		});
    		VStack stack = new VStack();
    		stack.addMember(form);
    		stack.addMember(save);
    		stack.draw();
               }

    #2
    What ar all your relevant versions? If you haven't tried with a nightly, please do so.

    Comment


      #3
      GWT 2.0.0
      8.1/LGPL Development Only (built 2010-06-19)
      I am using 2.0-SNAPSHOT (jar is dated 7/12/2010)

      Comment


        #4
        Not seeing this with the nightly SGWT and GWT 2.0.3. If a GWT upgrade doesn't fix it, please indicate everything else you can about your setup (starting with browser and OS).

        Comment


          #5
          I upgraded to GWT 2.0.3 and am using FF 3.6.6 on Windows XP. In the example above, if I don't specify a value for hours, it will return the selected options (and null for hours). If I specify an integer for hours, it will return an empty list.

          Also
          select.setValues("v1","v3");

          doesn't select the initial values.

          Comment


            #6
            Thanks for the additional information. This has been reproduced directly in SC and fix is being investigated.

            Comment


              #7
              A fix should be in the next nightly. It also addresses the setValues call.

              Comment


                #8
                BTW, I found that using MultipleAppearance.GRID made it work as well.

                Comment

                Working...
                X