public interface ContextualFormFragment
PluginFormFragments
Modifier and Type | Method and Description |
---|---|
void |
doError(Appendable appendable,
Map<String,String[]> requestParams,
Map<String,Collection<String>> fieldErrors,
Map<String,Object> context)
Render your fields after a validation error has occurred.
|
void |
doView(Appendable appendable,
Map<String,Object> context) |
void |
execute(Map<String,String[]> requestParams,
Map<String,Object> context)
Store the fields supplied by this form and perform any other actions.
|
void |
validate(Map<String,String[]> requestParams,
ValidationErrors errors,
Map<String,Object> context)
Validate the fields supplied by this form fragment.
|
void doView(@Nonnull Appendable appendable, @Nonnull Map<String,Object> context) throws IOException
appendable
- the Appendable
to append field HTML that will be injected into the form. The fields
should match the style of the pre-existing fields in the form.context
- map with relevant contextual objectsIOException
- if there was a problem writing to the supplied appendable.void validate(@Nonnull Map<String,String[]> requestParams, @Nonnull ValidationErrors errors, @Nonnull Map<String,Object> context)
ContextualFormFragment
.
See execute(Map, Map)
, which is invoked after validate(Map, ValidationErrors, Map)
if all
fragments have successfully validated. This method should make all
reasonable attempts to ensure that the subsequent invocation of execute(Map, Map)
will not fail.requestParams
- the map of parameters from the request. This will contain any input supplied by the user in
the fields rendered by doView(java.lang.Appendable, java.util.Map<java.lang.String, java.lang.Object>)
, alongside any other fields in the form rendered by
the system or other ContextualFormFragment
s.errors
- use this to report any validation errors on the input supplied from your fields. See
ValidationErrors
for more details.context
- map with relevant contextual objectsvoid doError(@Nonnull Appendable appendable, @Nonnull Map<String,String[]> requestParams, @Nonnull Map<String,Collection<String>> fieldErrors, @Nonnull Map<String,Object> context) throws IOException
ContextualFormFragment
.requestParams
- the map of parameters from the request. This will contain any input supplied by the user in
the fields rendered by doView(java.lang.Appendable, java.util.Map<java.lang.String, java.lang.Object>)
, alongside any other fields in the form rendered by
the system or other ContextualFormFragment
s.fieldErrors
- a Map
of String field names to sets of String error messages. If the field name
matches one of the fields supplied by your doView(java.lang.Appendable, java.util.Map<java.lang.String, java.lang.Object>)
implementation, you should render
the error messages alongside your field.appendable
- the Appendable
to append field HTML that will be injected into the form, with any
relevant errors supplied by the fieldErrors map rendered inline. The fields and error messaging
should match the style of the pre-existing fields in the form.context
- map with relevant contextual objectsIOException
- if there was a problem writing to the supplied appendable.void execute(@Nonnull Map<String,String[]> requestParams, @Nonnull Map<String,Object> context)
validate(java.util.Map<java.lang.String, java.lang.String[]>, com.atlassian.bitbucket.ui.ValidationErrors, java.util.Map<java.lang.String, java.lang.Object>)
method.
This method is invoked only if the validate(java.util.Map<java.lang.String, java.lang.String[]>, com.atlassian.bitbucket.ui.ValidationErrors, java.util.Map<java.lang.String, java.lang.Object>)
method on all registered ContextualFormFragment
s and the
form's own field validation has completed without any validation errors.requestParams
- the map of parameters from the request. This will contain any input supplied by the user in
the fields rendered by doView(java.lang.Appendable, java.util.Map<java.lang.String, java.lang.Object>)
, alongside any other fields in the form rendered by
the system or other ContextualFormFragment
s.context
- a map of contextual objects that can be used by the form fragment implementation, such as
the project, repository or pull request if relevant.Copyright © 2024 Atlassian. All rights reserved.