package controllers.application;

import play.mvc.*;
import play.data.Form;
import static play.data.Form.*;

import views.formdata.*;


public class Section0 extends Controller {
    private static final Form<EthicsTriageForm> triageForm = form(EthicsTriageForm.class);

    public static Result section0(Long id) {
        return section0((EthicsTriageForm) null);
    }

    public static Result section0(EthicsTriageForm data) {
        Form<EthicsTriageForm> triageForm = this.triageForm;

        if (data != null) {
            triageForm.fill(data);
            // re-fill with data for editing...
        } else {
            // here we would retrieve a filled form from the database, if available
        }

        return ok(views.html.application.section0.render(triageForm));
    }

    public static Result section0_post(Long id) {
        if (request().body().isMaxSizeExceeded()) {
            return badRequest("Too much data!");
        }

        Form<EthicsTriageForm> triageForm = triageForm.bindFromRequest();

        if (triageForm.hasErrors()) {
            System.out.println(triageForm.errorsAsJson());
            return badRequest(views.html.application.section0.render(triageForm));
        }

        EthicsTriageForm data = triageForm.get();
        System.out.println(data);

        return section0(data);
    }
}

@@ -448,33 +448,39 @@
 hicsTriageForm%3E 
-t
+filledT
 riageForm = this
@@ -479,13 +479,8 @@
 m = 
-this.
 tria
@@ -528,17 +528,42 @@
         
-t
+filledTriageForm = filledT
 riageFor
@@ -785,33 +785,39 @@
 section0.render(
-t
+filledT
 riageForm));%0A   
@@ -1009,30 +1009,30 @@
 TriageForm%3E 
-triage
+filled
 Form = triag
@@ -1056,17 +1056,16 @@
 uest();%0A
-%0A
         
@@ -1070,16 +1070,15 @@
   if
- (triage
+(filled
 Form
@@ -1231,24 +1231,25 @@
 iageForm));%0A
+%0A
         %7D%0A%0A 
@@ -1237,34 +1237,44 @@
 rm));%0A%0A        %7D
-%0A%0A
+ else %7B%0A    
         EthicsTr
@@ -1289,22 +1289,22 @@
  data = 
-triage
+filled
 Form.get
@@ -1303,24 +1303,28 @@
 Form.get();%0A
+    
         Syst
@@ -1346,32 +1346,36 @@
 data);%0A%0A        
+    
 return section0(
@@ -1377,20 +1377,30 @@
 ion0(data);%0A
+        %7D%0A
     %7D%0A%7D%0A

Clean up form handling some more