Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

LogicalDate object failing isADate validation

$
0
0
SmartClient Version: v10.0p_2015-05-09/PowerEdition Deployment (built 2015-05-09)

We have a CanvasItem in formA which has a canvas consisting of formB. formB includes a DateItem on which there is a changedHandler which stores the new value as the CanvasItem's value. The CanvasItem is used to edit a field defined as type="date" in the datasource. When .validate is called on formA we're getting a validation error on the CanvasItem saying "Must be a date", even when the value is a valid date.

Using the Chrome debugger we can see that the Object being validated is a LogicalDate, so the comparison being done in the return statement (in the attached screen shot from isc_Core.js) is returning false because it is looking for an object.constructor function named "Date", but the LogicalDate object's constructor function is named "Object".

The CanvasItem's value is updated by a ChangedHandler on the DateItem like this, where "editor" refers to the CanvasItem.
Code:

outerHandoverDate.addChangedHandler(new ChangedHandler() {
  @Override
  public void onChanged(ChangedEvent event) {
    editor.storeValue((Date)event.getValue());
  }
});

Why does casting the event value as a Date result in a LogicalDate object? Is that the correct way to store the value? And why does the LogicalDate not validate as a date?

Attached Images
File Type: png IsADate.png (65.6 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles