jQWidgets Forums

jQuery UI Widgets Forums Angular The jqxValidator does not work in jqxWindow.

This topic contains 2 replies, has 2 voices, and was last updated by  hayato 5 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • hayato
    Participant

    The jqxValidator does not work in jqxWindow.
    How do I use jqxValidator in jqxWindow?

    For example,
    1. Set jqxValidator on screen A. (At this time, “validate” works.)
    2. Transit to Screen B with “routerLink”.
    3. Move to screen A with “routerLink”. (At this time, “validate” does not work.)

    ~~~ template code. ~~~

    <jqxWindow [isModal]="true">
      <div>TEST</div>
      <div>
        <jqxValidator #testValidator (onValidationSuccess)="onSuccess();" [rules]="testRules">
          <form id="testForm">
            <jqxInput #testText id="testText"></jqxInput>
            <jqxButton (onClick)="validate()">Validate</jqxButton>
          </form>
        </jqxValidator>
      </div>
    </jqxWindow>

    ~~~ typescript code. ~~~

    @ViewChild('testValidator', { static: false }) testValidator: jqxValidatorComponent;
    testRules = [
      { input: '#testText', message: 'ERROR!!', action: 'keyup, blur', rule: 'required' }
    ];
    onSuccess() {
      console.log("Success!!");
    }
    validate() {
      this.testValidator.validate();
    }

    Hristo
    Participant

    Hello hayato,

    The approach that you could try to use for this is with the createInstance method.
    You could look at this demo for a reference.
    Another approach that you could use is with Dynamic Injection which provides you the option to add the wanted component wherever you want.
    Please, take a look at this tutorial.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    hayato
    Participant

    Hi Hristo.

    Thank you for answering.

    I was able to solve it safely.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.