Package javango.forms

Examples of javango.forms.Form.bind()


    }
   

   
    if ("POST".equals(request.getMethod())) {
      form.bind(request.getParameterMap());
      if (form.isValid()) {
        // TODO better way to get the relative 'admin' part of the url
        Map<String, String> params = new HashMap<String, String>();
        generateSearchParams(request, params);
        return new HttpResponseRedirect("../", params);
View Full Code Here


     
      if ("POST".equals(request.getMethod())) {
        // update the object
        if (object == null) object=injector.getInstance(pc);
       
        form.bind(request.getParameterMap());
        // form = modelFactory.form(pc.getMappedClass(), request.getParameterMap());
        if (form.isValid()) {
//          if (object_id == null) { // this is a new object
//            if (!bl.canCreate()) {
//              throw new HttpException("Unable to create");
View Full Code Here

 
  public void testRequireByDefault() throws Exception {
    Map<String, String[]> m = new HashMap<String, String[]>();
    m.put("message", new String[] {"Hi there"});       
    Form f = formFactory.forModel(ContactBean.class);
    f.bind(m);   
    assertFalse(f.isValid());
    Map errors = f.getErrors();
    assertTrue(errors.containsKey("subject"));
    assertTrue(errors.containsKey("sender"));
    assertTrue(errors.containsKey("value"));
View Full Code Here

    Map<String, String[]> m = new HashMap<String, String[]>();

    m.put("prefix-newvalue", new String[] {"1234"});
    Form f = injector.getInstance(ContactForm.class);
    f.getFields().get("value").setName("newvalue");
    f.bind(m).setPrefix("prefix").setId(null);
    f.isValid();
    String expected = "<input type=\"text\" name=\"prefix-newvalue\" value=\"1234\" />";   
    assertEquals(expected, f.get("value").toString());
   
    expected = "<tr><th>Newvalue</th><td><input type=\"text\" name=\"prefix-newvalue\" value=\"1234\" /></td></tr>\n";
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.