Textalk / angular-schema-form-datepicker

Datepicker add-on for Angular Schema Form using pickadate!
MIT License
43 stars 57 forks source link

Form does not render with only datepicker fields. #47

Closed Sigkill9 closed 6 years ago

Sigkill9 commented 7 years ago

Forms do not render if only datepicker fields exist.

The following does not render

//schema
{
  "type": "object",
  "properties": {
    "date_complete": {
      "type": "string",
      "required": true,
      "format": "date"
    },
    "close_date": {
      "type": "string",
      "required": true,
      "format": "date"
    }
  }
}

//form
[
  {
    "key": "date_complete",
    "title": "Completed Date",
    "type": "datepicker",
    "readonly": false,
    "description": "Please Supply The Date This Task Was Completed.",
    "format": "mm/dd/yyyy"
  },
  {
    "key": "close_date",
    "title": "Close Date",
    "type": "datepicker",
    "readonly": false,
    "description": "Please Supply The Close Date.",
    "format": "mm/dd/yyyy"
  }
]

If I add a basic text field into the mix the form renders fine.

//schema
{
  "type": "object",
  "properties": {
    "date_complete": {
      "type": "string",
      "required": true,
      "format": "date"
    },
    "close_date": {
      "type": "string",
      "required": true,
      "format": "date"
    },
    "basicfield": {
      "type": "string"
    }
  }
}
//form
[
  {
    "key":"date_complete",
    "title": "Completed Date",
    "type": "datepicker",
    "readonly": false,
    "description": "Please Supply The Date This Was Completed.",
    "format": "mm/dd/yyyy",
    "required": true
  },{
    "key": "close_date",
    "title": "Close Date",
    "type": "datepicker",
    "readonly": false,
    "description": "Please Supply The Close Date.",
    "format": "mm/dd/yyyy",
    "required": true
  },
  {
    "key":"basicfield",
    "title": "basicfield"
  }
]

Any ideas?

Redrawing the form works but seems like a hack.

        let setScopesASF = doc =>{
          $scope.form   = doc.form;
          $scope.schema = doc.schema;

          $timeout(100, ()=>$scope.$broadcast('schemaFormRedraw'));
        };
Sigkill9 commented 6 years ago

Decided to move on. Went to form.io. all problems solved.