Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #103044
    Rafa Esparza
    Participant
    Up
    0
    Down

    I need the inputs not to be validated until data is entered into them. The first time the window loads, when they are empty, they should not turn red.

    Does anyone know how to do this?

    Thanks in advance

    #103045
    admin
    Keymaster
    Up
    0
    Down

    Hi Rafa,

    They usually are not validated unless the validation is invoked from the API or during the user Input. Example: https://www.htmlelements.com/demos/form/template/
    How do you use the Form component?

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

    #103046
    Rafa Esparza
    Participant
    Up
    0
    Down

    I’m creating like this. I want to have the input empty in the beginning, but not appears in red.

     this.form = new Smart.Form('#ejemploForm', {
          codigo: ['', {
            validationRules: [
               { type: 'required', message: 'Codigo is required' },
            ]
          }],
          nombre: ['', {
            validationRules: [
              { type: 'required', message: 'Name is required' },
              { type: 'stringLength', min: 2, message: 'First Name requires minimum 2 characters' }
            ],
          }
          ]
        });
    #103049
    admin
    Keymaster
    Up
    0
    Down

    Hi Rafa,

    Thanks for the code. We will need to add a new property to the form to disable validation when the form is created. That will be available in the next version so you will be able to enable/disable Form’s onload validation.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.