Search code examples
angulardevextreme-angular

submit form button is not firing


I have a devextreme form with some fields and a submit button on it. If I hit the submit button, the corresponding click event in the component isn't firing. The useSubmitBehavior is set to true and the submit event is set to the component click event. Here is a simple example: example


Solution

  • You've to put your <dx-form> tag inside <form> and move (submit)="formSubmit()" to<form> tag

    <form (submit)="formSubmit()">
      <dx-form>
        <dxi-item dataField="name">
          <dxi-validation-rule type="async" message="name already exists" 
           [validationCallback]="alreadyExists">
          </dxi-validation-rule>
        </dxi-item>
        <dxi-item>
          <dx-button text="submit" [useSubmitBehavior]="true"></dx-button>
          <dx-button text="close" (click)="closeButtonClick()"></dx-button>
        </dxi-item>
      </dx-form>
    </form>