Package javango.forms.fields

Examples of javango.forms.fields.ChoiceField


    Map<String, String> choices = new LinkedHashMap<String, String>();
    choices.put("1", "One");
    choices.put("2", "Two");
    SelectWidget w = new SelectWidget();
    ChoiceField field = (ChoiceField) new SelectField(injector.getInstance(WidgetFactory.class)).setChoices(choices).setAllowNull(false).setName("pickme");
//    w.setField(field);
   
    String[] o = w.valueFromMap(postData, "pickme");
    assertEquals("2", o[0]);
   
    Map<String, String> errors = new HashMap<String, String>();
    Object cleaned = field.clean(o, errors);
    assertTrue(errors.isEmpty());
    assertEquals("2", cleaned);
  }
View Full Code Here

TOP

Related Classes of javango.forms.fields.ChoiceField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.