Polymer: Cuba-Service-Form Malfunctioning

The cuba-service-form element does not work as expected.

Problems:

  1. Property result is set with readOnly: true. This requires the property to be set by this._setResult = ..., as this.result = ... will not work. Currently, result is attempted to be set by this.result = ..., but in fact does not get set.
    Docs: https://www.polymer-project.org/1.0/docs/devguide/properties#read-only

  2. submit() does not return the resolved response, so the only way to access the result of the service is through the result property. But since the result property is not being set (see #1), there is no way to access the result of the service at all, effectively eliminating the ability to use this component if a response is required.

Workaround:
I’m just going to be calling app.invokeService manually.

1 Like

Hi Caden,

Thanks for reporting the issue, it’s fixed. Update your cuba-form dependency to version 0.2.2 .
Also the API was changed in order to return promise which resolves with data/error. Since this changes the API it’s released under 0.3.0 tag (which you could also try to use)

Fantastic! All is working.

One minor issue, though - the new version (0.2.2) declares its version to be 0.2.1 incorrectly.
Also, version 0.3.0 doesn’t declare its version at all in bower.json (though it is present in .bower.json). I’m not very familiar with Bower, so I’m not sure whether it’s supposed to or not.

I noticed that you are now (as of 0.3.0) passing the data/error along in the response/error event. Very nice, I like that.

Thanks very much!

Hi, as for versions in bower.json - thanks for noticing it. Actually it does not affect anything, so they will be stripped in the newer versions of components.

1 Like