New data model not working with "create button"

24 views
Skip to first unread message

slooker

unread,
Oct 12, 2015, 7:06:46 PM10/12/15
to Keystone JS
I've created a new model named "Agencies" and the code is simplistic for now:

var keystone = require('keystone'),

   Types = keystone.Field.Types;


var Agency = new keystone.List('Agency');


Agency.add({

   name: { type: Types.Name, required: true, index: true },

   email: { type: Types.Email, initial: true, required: true, index: true },

   video: { type: Types.Url, required: false, index: false },

   approved: { type: Types.Boolean, initial: false, required: true, index: true },

});


Agency.register();


The problem I have is when I sign in to the admin portion and click "Create Agency".  I don't have all the fields.  What am I doing wrong?


Lenny Boyatzis

unread,
Oct 13, 2015, 12:35:25 AM10/13/15
to Keystone JS
Hi slooker,

To get a field to show in the create item form, just add the option initial: true

Note: The name field is an exception to this rule and doesn't require this option to be displayed in the create item form

Check out the docs for more info


Cheers,

Lenny

slooker

unread,
Oct 13, 2015, 1:24:49 AM10/13/15
to Keystone JS
Thanks!  I was trying to find those docs and didn't manage it.  I'll read up.  

Appreciate it!
Reply all
Reply to author
Forward
0 new messages