Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

65
Vistas
How to show allowBlank error only on form submission?

I have a form with textfield and textareafield, I have provided allowBlank: false to both the columns, but I need to show Red error design and blank error only on form submission not before that. How to do that?

7 months ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Form fields have two boolean configs, validateOnBlur and validateOnChange. If you set these to false, fields won't be validated during user input. In this case you have add a code for example to your submit button, to check for validation errors. Ext.form.Basic has isValid and hasInvalidField methods that you can call, the first marks validation errors, the second does not.

7 months ago · Juan Pablo Isaza Denunciar

0

@Peter Koltai has the correct answer for classic.

For modern you should use:

    validateTextfield(field) {
        test...
        if(!valid){
            field.setErrorMessage('bad decision');
        }
    },
    onBeforeSubmit() {
        const form = this.getView(),
            values = form.getValues(),
            isTextFieldValid = this.validateTextfield(values.fromTextField);
        return isTextFieldValid;
    }
    onSubmit() {
        const isValid = this.onBeforeSubmit();

        if(!isValid) return;

        doMySubmission();
    }

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.