Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value from schema overwrites explicit property value in lib-content.create() #8149

Closed
alansemenov opened this issue Jun 10, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@alansemenov
Copy link
Member

alansemenov commented Jun 10, 2020

Content type schema:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content-type>
  <display-name>Date</display-name>
  <super-type>base:structured</super-type>
  <form>
    <input name="date" type="Date">
      <label>Date</label>
      <indexed>true</indexed>
      <occurrences minimum="1" maximum="1"/>
      <default>2000-01-01</default>
    </input>
  </form>
</content-type>

Create new content of this type:

var contentLib = require('/lib/xp/content');

var content = contentLib.create({
    name: 'myContent',
    parentPath: '/',
    displayName: 'My Content',
    contentType: 'com.enonic.app.mytype:date',
    data: {
        "date": "2020-06-02"
    }
});

Here we explicitly say that the new content should have value 2020-06-02 in the date field, but content is still created with default value 2000-01-01

@alansemenov alansemenov added this to the 7.3.1 milestone Jun 10, 2020
@alansemenov
Copy link
Member Author

NB! Check if we have this problem for other input types where we support default values as well.

@sgauruseu
Copy link
Member

I verified this bug manually. I am planning to add ui-test for this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants