Skip to content

Onchange update the Schema not working  #428

@senthilsendhil

Description

@senthilsendhil

I like to update my schema after Form loader through onChange,

but schema not getting updated, Please refer the below controller code.

 $scope.testOnchange = function() {
    console.log('came here');
    $scope.schema.properties.profileDetails.properties.address.properties.
    addressDetails.items.properties.addressFormat = ['dym', 'dym1'];
    $scope.$broadcast('schemaFormRedraw');

  };
  $scope.schema = {
    "type": "object",
    "title": "Comment",
    "properties": {
      "profileDetails": {

        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "properties": {
              "addressDetails": {
                "title": "Contact Person",
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "properties": {
                    "addressType": {
                      "title": "Contact Type",
                      "description": "Select",

                      "type": "string",
                      "default": "test",
                      "enum": ["test", "test1"]
                    },
                    "addressFormat": {
                      "title": "Address Format",
                      "description": "Select",
                      "type": "string",
                      "default": "test",
                      "enum": []
                    }
                  }
                }
              }
            }
          }
        }
      }

    }
  };


  $scope.form = [{
      "key": "profileDetails.address.addressDetails",
      "title": "The array",
      "type": "array",
      "items": [{
          "key": "profileDetails.address.addressDetails[].addressType",
          "onChange": "testOnchange()"
        }, {
          "key": "profileDetails.address.addressDetails[].addressFormat",

        }



      ]
    }, {
      "type": "submit",
      "style": "btn-info",
      "title": "OK"
    }

  ];

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions