Search code examples
angularformio

How to hide the alert-danger in FormIO?


I'am using FormIO in Angular 7 and I don't want to display the alert-danger (the first) who contains "Societe est obligatoire" in my form if it's not valid.

enter image description here

this is my form declared in form-io.component.ts

form= {
components: [
  {
      type: "textfield",
      input: true,
      tableView: true,
      inputType: "text",
      inputMask: "",
      label: "Societe",
      key: "societe",
      placeholder: "societe",
      multiple: false,
      defaultValue: "",
      protected: false,
      unique: false,
      persistent: true,
      validate: {
          required: true,
          minLength: 1,
          pattern: "",
          custom: "",
          customPrivate: false
      },
      conditional: {
          show: "",
          when: null,
          eq: ""
      }
  },
  {
    input:true,
    label:"Validate",
    tableView:false,
    key:"ValidateFournisseur",
    size:"md",
    block:false,
    action:"submit",
    disableOnInvalid:true,
    theme:"primary",
    type:"button",   
    hidden:false 
  } 

and this is my form-io.component.html

<formio [form]="form"></formio>

Any help?


Solution

  • For those who still looking for the answer

    in your html

    <formio [form]="form" [options]="options" ></formio>
    

    and in yout ts file

    options: Object = {
      submitMessage: "",
      disableAlerts: true,
      noAlerts: true
    }
    

    Hope it helps