Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting warning from PropertyInputForm #103

Open
vaithu opened this issue Jun 11, 2020 · 2 comments
Open

Getting warning from PropertyInputForm #103

vaithu opened this issue Jun 11, 2020 · 2 comments

Comments

@vaithu
Copy link

vaithu commented Jun 11, 2020

This is the warning I'm getting
Cannot notify validation error [Value is required] on component [com.holonplatform.vaadin.flow.internal.components.InputAdapter@27b15a3c]: the component does not implement com.vaadin.flow.component.HasValidation. Provide a suitable ValidationStatusHandler to handle the validation error notification.

PropertyInputForm inputForm = PropertyInputForm.builder(formLayout, SignUp.PROPERTIES)
                .composer((content, source) -> {
                    source.getComponents().forEach(component -> {
                        content.add(component);
                    });
                })
                .withPostProcessor((property, input) -> {
                    input.setRequired(true);
                    if (SignUp.USRHANDLE.equals(property)) {
                        formLayout.setColspan(input.getComponent(), 2);
                    }

                    if (SignUp.EMAIL.equals(property)) {
                        input.getComponent().setVisible(false);
                    }
                })
                .initializer(content -> {
                    content.setMaxWidth("500px");
                    content.getStyle().set("margin", "0 auto");
                    content.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1, FormLayout.ResponsiveStep.LabelsPosition.TOP),
                            new FormLayout.ResponsiveStep("490px", 2, FormLayout.ResponsiveStep.LabelsPosition.TOP));
                })
                .bind(SignUp.PWD1, createSecretInput())
                .bind(SignUp.PWD2, createSecretInput())
                .validationStatusLabel(errorLabel)
                .validateOnValueChange(true)
                .build();
@axholo
Copy link
Contributor

axholo commented Jul 20, 2020

Each validatable form input component has to implement com.vaadin.flow.component.HasValidation to notify validation errors. This is the reason for warning.
Maybe you have some custom Input components not implementing it?
Can you provide the code for createSecretInput() methods?

@vaithu
Copy link
Author

vaithu commented Jul 21, 2020

Here is the code for createSecretInput()

private ValidatableInput<String> createSecretInput() {
        return ValidatableInput.builder(Components.input.secretString()
                .required()
                .build())
                .validateOnValueChange(false).build();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants