Examples of InlineForms


Examples of javango.forms.InlineForms

    m.put("myforms[0]-subject", new String[] {"hello"});
    m.put("myforms[0]-message", new String[] {"Hi there"});
    m.put("myforms[1]-subject", new String[] {"hello"});
    m.put("myforms[1]-message", new String[] {"Hi there"});

    InlineForms forms = formFactory.inlineForms("myforms");
    forms.add(injector.getInstance(ContactForm.class).bind(m));
    forms.add(injector.getInstance(ContactForm.class).bind(m));

    int ctr = 0;
    for (Form form : forms) {
      assertTrue(form.isValid()); // is valid must be called before a bound form can be rendered.
      assertEquals(
          String.format("<tr><th><label for='id_myforms[%1$d]-subject'>Subject</label></th><td><input id=\"id_myforms[%1$d]-subject\" type=\"text\" name=\"myforms[%1$d]-subject\" value=\"hello\" /></td></tr>\n" +
                "<tr><th><label for='id_myforms[%1$d]-message'>Message</label></th><td><input id=\"id_myforms[%1$d]-message\" type=\"text\" name=\"myforms[%1$d]-message\" value=\"Hi there\" /></td></tr>\n",
                ctr++), form.asTable());
    }
    assertEquals(ctr, 2);
   
    Iterator<BoundField> boundFields = forms.getControlFields();
    assertEquals("<input id=\"id_myforms_CTRL-fieldCount\" type=\"hidden\" name=\"myforms_CTRL-fieldCount\" value=\"2\" />",boundFields.next().toString());
  }
View Full Code Here

Examples of javango.forms.InlineForms

    m.put("myforms[0]-message", new String[] {"Hi there 0"});
    m.put("myforms[1]-subject", new String[] {"hello 1"});
    m.put("myforms[1]-message", new String[] {"Hi there 1"});
    m.put("myforms_CTRL-fieldCount", new String[] {"2"});
   
    InlineForms forms = formFactory.inlineForms("myforms", "subject", ContactForm.class, m);
    assertEquals("myforms", forms.getPrefix());
    assertEquals(forms.size(), 2);
   
    int ctr = 0;
    for (Form form : forms) {
      assertTrue(form.isValid()); // is valid must be called before a bound form can be rendered.
      assertEquals("hello " + ctr, form.getCleanedData().get("subject"));
View Full Code Here

Examples of javango.forms.InlineForms

    m.put("myforms[0]-message", new String[] {"Hi there 0"});
    m.put("myforms[2]-subject", new String[] {"hello 1"});
    m.put("myforms[2]-message", new String[] {"Hi there 1"});
    m.put("myforms_CTRL-fieldCount", new String[] {"3"})// 0,1,2 in this case 1 is missing (maybe deleted)
   
    InlineForms forms = formFactory.inlineForms("myforms", "subject", ContactForm.class, m);
    assertEquals("myforms", forms.getPrefix());
    assertEquals(2, forms.size());
   
    int ctr = 0;
    for (Form form : forms) {
      assertTrue(form.isValid()); // is valid must be called before a bound form can be rendered.
      assertEquals("hello " + ctr, form.getCleanedData().get("subject"));
View Full Code Here

Examples of javango.forms.InlineForms

  public void testHandlPostNoForms() throws Exception {
   
    Map<String, String[]> m = new HashMap<String, String[]>();
    m.put("myforms_CTRL-fieldCount", new String[] {""});
   
    InlineForms forms = formFactory.inlineForms("myforms", "subject", ContactForm.class, m);
    assertEquals("myforms", forms.getPrefix());
    assertEquals(0, forms.size());
  }
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.