use of com.helger.photon.core.form.FormErrorList in project peppol-practical by phax.
the class PagePublicSignUp method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final FormErrorList aFormErrors = new FormErrorList();
boolean bShowForm = true;
if (aWPEC.hasSubAction(CPageParam.ACTION_SAVE)) {
// try to save
validateAndSaveInputParameters(aWPEC, aFormErrors);
if (aFormErrors.isEmpty()) {
// Save successful
bShowForm = false;
} else
aNodeList.addChild(getUIHandler().createIncorrectInputBox(aWPEC));
}
if (bShowForm) {
final AbstractHCForm<?> aForm = aNodeList.addAndReturnChild(getUIHandler().createFormSelf(aWPEC));
showInputForm(aDisplayLocale, aForm, aFormErrors);
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_CREATE);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
// Save button
aToolbar.addSubmitButton("Sign up now", EDefaultIcon.YES);
aForm.addChild(aToolbar);
}
}
Aggregations