Validation error

Error presentado


Código de validación
 componentDidMount(){   
        this.setState({show: this.props.show});

         //validaciones de fomulario
         const options = {

            
            // add the rules for validation
           rules: {
            'timepicker': {
              required: [true'* La Hora es requerida'],
               maxLength: [10'* Máximo 10 carácteres']
            },
            'lugar': {
                maxLength: [100'* Máximo 100 carácteres']
              },
            'fecha': {
              required: [true'*']
            },
            'idActa': {
                required: [true'*']
            },
            'idLibro': {
                required: [true'*']
            }
          },
          customPlacement: (inputElementerrorElement=> {
            inputElement.parentElement.parentElement.appendChild(errorElement); 
        }
        };
        // initialize the form validator
        this.formObject = new FormValidator('#ActaEditFrm'options);
        this.formObject.addRules('timepicker', {required: truemaxLength:10});

    }

Formulario 


1 Reply

SN Sevvandhi Nagulan Syncfusion Team May 7, 2021 11:51 AM UTC

Hi DEIMER, 


Greetings from Syncfusion support. 


We checked your query of “Console error was thrown ‘cannot read property parentElement of null when validating the form using FormValidation’ ”. We were unable to replicate the reported issue at our end. We tried to replicate the reported issue by  “prepared the sample using react bootstrap modal and placed the TimePicker component inside the modal and validated the component using FormValidator”. Also, based on the stack trace in the provided screenshot, we suspect that the reported issue occurs if the timepicker input element is not present in the DOM, and that if we try to validate the form, the console error will occur.  So kindly share the additional information such as issue replicating steps and if possible, modify the below sample to replicate the issue at our end. Please find the sample below 




Kindly get back to us for further assistance. 


Regards, 
Sevvandhi N 


Loader.
Up arrow icon