Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #101871
    david
    Member

    I tried using a validator with a smart input, when I set a required rule and render the component with empty input, it is correctly shows an error state, however if I manually enter some text, and then reset the field back to empty value with a button click, the validator does not trigger, and the field still shows as valid despite being empty. I guess it is connected to the fact that the validator is triggered by events, so how could I trigger the validation to show the validation state correctly?
    I tried programatically firing the event:
    <div>
    <div>    const element = document.querySelector(#field);</div>
    <div>    if (element) {</div>
    <div>      const event = new Event(‘keyup’, {</div>
    <div>        bubbles: true</div>
    <div>      });</div>
    <div>      element.dispatchEvent(event);</div>
    <div>    }</div>
    </div>
    <div>That did not trigger validation either.</div>

    #101872
    yavordashew
    Member

    Hi david,
    I did some testing on the validator in different situations but I was unable to reproduce the issue that you do.
    So I would like to ask you to create a code example which reproduces this behavior for us in order to give a solution for your case.
    Please, do not hesitate to contact us if you have any additional questions.
    Best regards,
    Yavor Dashev
    Smart UI Team
    https://www.htmlelements.com/

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