public class DynamicForm extends Form<DynamicForm.Dynamic>
HashMap<String,String>
Modifier and Type | Class and Description |
---|---|
static class |
DynamicForm.Dynamic
Simple data structure used by
DynamicForm . |
Form.Display, Form.Field
Constructor and Description |
---|
DynamicForm()
Creates a new empty dynamic form.
|
DynamicForm(java.util.Map<java.lang.String,java.lang.String> data,
java.util.Map<java.lang.String,java.util.List<ValidationError>> errors,
F.Option<DynamicForm.Dynamic> value)
Creates a new dynamic form.
|
Modifier and Type | Method and Description |
---|---|
DynamicForm |
bind(java.util.Map<java.lang.String,java.lang.String> data,
java.lang.String... allowedFields)
Binds data to this form - that is, handles form submission.
|
DynamicForm |
bindFromRequest(Http.Request request,
java.lang.String... allowedFields)
Binds request data to this form - that is, handles form submission.
|
DynamicForm |
bindFromRequest(java.lang.String... allowedFields)
Binds request data to this form - that is, handles form submission.
|
java.util.Map<java.lang.String,java.lang.String> |
data()
Retrieves the actual form data.
|
ValidationError |
error(java.lang.String key)
Retrieve an error by key.
|
Form.Field |
field(java.lang.String key)
Retrieves a field.
|
DynamicForm |
fill(java.util.Map value)
Fille with existing data.
|
java.lang.String |
get(java.lang.String key)
Gets the concrete value if the submission was a success.
|
void |
reject(java.lang.String key,
java.lang.String error)
Adds an error to this form.
|
void |
reject(java.lang.String key,
java.lang.String error,
java.util.List<java.lang.Object> args)
Adds an error to this form.
|
apply, bind, bindFromRequest, discardErrors, errors, errorsAsJson, errorsAsJson, fill, form, form, form, form, form, get, getArgumentsForConstraint, getMessageForConstraintViolation, globalError, globalErrors, hasErrors, hasGlobalErrors, name, reject, reject, reject, requestData, toString, value
public DynamicForm()
public DynamicForm(java.util.Map<java.lang.String,java.lang.String> data, java.util.Map<java.lang.String,java.util.List<ValidationError>> errors, F.Option<DynamicForm.Dynamic> value)
data
- the current form data (used to display the form)errors
- the collection of errors associated with this formvalue
- optional concrete value if the form submission was successfulpublic java.lang.String get(java.lang.String key)
public java.util.Map<java.lang.String,java.lang.String> data()
Form
data
in class Form<DynamicForm.Dynamic>
public DynamicForm fill(java.util.Map value)
public DynamicForm bindFromRequest(java.lang.String... allowedFields)
bindFromRequest
in class Form<DynamicForm.Dynamic>
public DynamicForm bindFromRequest(Http.Request request, java.lang.String... allowedFields)
bindFromRequest
in class Form<DynamicForm.Dynamic>
public DynamicForm bind(java.util.Map<java.lang.String,java.lang.String> data, java.lang.String... allowedFields)
bind
in class Form<DynamicForm.Dynamic>
data
- data to submitpublic Form.Field field(java.lang.String key)
field
in class Form<DynamicForm.Dynamic>
key
- field namepublic ValidationError error(java.lang.String key)
error
in class Form<DynamicForm.Dynamic>
public void reject(java.lang.String key, java.lang.String error, java.util.List<java.lang.Object> args)
reject
in class Form<DynamicForm.Dynamic>
key
- the error keyerror
- the error messageargs
- the errot argumentspublic void reject(java.lang.String key, java.lang.String error)
reject
in class Form<DynamicForm.Dynamic>
key
- the error keyerror
- the error message