Search in sources :

Example 21 with FormErrorList

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);
    }
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) FormErrorList(com.helger.photon.core.form.FormErrorList) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)

Aggregations

HCNodeList (com.helger.html.hc.impl.HCNodeList)21 FormErrorList (com.helger.photon.core.form.FormErrorList)21 BootstrapForm (com.helger.photon.bootstrap4.form.BootstrapForm)20 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)20 RequestField (com.helger.photon.core.form.RequestField)19 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)18 Locale (java.util.Locale)16 HCEdit (com.helger.html.hc.html.forms.HCEdit)15 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)10 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)9 HCA (com.helger.html.hc.html.textlevel.HCA)8 ICommonsList (com.helger.commons.collection.impl.ICommonsList)7 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)6 PDTToString (com.helger.commons.datetime.PDTToString)6 ISimpleURL (com.helger.commons.url.ISimpleURL)6 HCHiddenField (com.helger.html.hc.html.forms.HCHiddenField)6 HCTextArea (com.helger.html.hc.html.forms.HCTextArea)6 HCRow (com.helger.html.hc.html.tabular.HCRow)6 HCTable (com.helger.html.hc.html.tabular.HCTable)6 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)6