Keystone.js admin interface - no form fields




I created a model like this:



```
var keystone = require('keystone'),
    Types = keystone.Field.Types;

var Page = new keystone.List('Page', {
    autokey: { path: 'slug', from: 'menuTitle', unique: true },
    map: { name: 'menuTitle' },
});

Page.add({
    keyword: { type: Types.Key, required: true, initial: false },
    slug: { type: Types.Key, required: true, initial: false },
    type: { type: Types.Select, options: 'textpage, projects, services, contacts, homepage', default: 'textpage' },
    menuTitle: { type: String, required: true, initial: false },
    pageTitle: { type: String },
    pageContent: { type: Types.Html, wysiwyg: true, height: 400 },
    seoTitle: { type: String },
    seoKeywords: { type: String },
    seoDescription: { type: String },
    isActive: { type: Types.Boolean }
});

Page.defaultColumns = 'keyword, slug, menuTitle, isActive';
Page.register();

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

I expected it to generate a list of objects and a form to create those objects. But the form has no fields.![enter image description here](https://fooobar.com//img/e1a87dbd6f806053a8bbc0a40750d174.png)


What am I doing wrong? Or what else should I do to get a form with all fields?
Basically you don't see any fields because you have the option `initial`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

set to `false`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

for all of them.


 `initial`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

the default is used `false`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, except for the "name" field, that is, the default is an outline field `name`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

or path that matches the mapping specified by Keystone for `name`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, in your case `menuTitle`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.


So normally your field `menuTitle`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

will render, expect you to explicitly tell it not with customization `initial: false`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

To display the fields, just set the ones you want `initial: true`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, for example:



```
var keystone = require('keystone'),
    Types = keystone.Field.Types;

var Page = new keystone.List('Page', {
    autokey: { path: 'slug', from: 'menuTitle', unique: true },
    map: { name: 'menuTitle' },
});

Page.add({
    keyword: { type: Types.Key, required: true, initial: true },
    type: { type: Types.Select, options: 'textpage, projects, services, contacts, homepage', default: 'textpage' },
    menuTtle: { type: String, required: true, initial: true },
    pageTitle: { type: String, initial: true },
    pageContent: { type: Types.Html, wysiwyg: true, height: 400 },
    seoTitle: { type: String },
    seoKeywords: { type: String },
    seoDescription: { type: String },
    isActive: { type: Types.Boolean }
});

Page.defaultColumns = 'keyword, slug, menuTitle, isActive';
Page.register();

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

It's also worth noting that you don't need to add a field `slug`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

; it is automatically added to the schema for you due to your settings `autokey`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.
You can set the format of the fields to "None". so here's what we've found:

so if your form is empty and then you add content to a blank form, it actually obey's the ui:emptyvalue value

if your form is passed data when you view it, e.g you're editing data then the json schema form doesn't really understand how to utilize the ui:emptyvalue value… [image] bryan:

you will need to hunt through the page and find the raw html dom object.

thank you. but i guess, it’s impossible to open select widget.

callback = customjs(args=dict(select\_=select),code="""

var el = document.getelementsbyname(select\_.name)[0];

… hi larry, - - thank you for writing. - - to disable the arrow keys you need to override the onkeydown method:  - - class mypageview : radpageview - { -     protected override void onkeydown(keyeventargs e) -     { -         if (e.keycode == keys.left || e.keycode == keys.right) -         { -             return; -         } -         base.onkeydown(e); -     } - } - - - i hope this information is useful. let me know if you need further assistance. - - regards, - dimitar - telerik by progress - - try our brand new, jquery-free angular 2 components built from ground-up which - deliver the business app essential building blocks - a grid component, - data visualization (charts) and form elements. - hi chris, 
if you use relations api, you may set properties field in your query. in this field you should set the names of the properties which values must be retrieved from the server. the argument should be a string in the following format: "propertyname1, propertyname2, , , propertynamen" , wher… i am not a salesforce expert, but checking this video here: <https://www.youtube.com/watch?v=c2vnmg4f4ho> , it looks like you will need to setup several fields in the http post for campaign builder.

the salesforce form has several hidden and text fields that need to be mapped accordingly. the hidden… JavaScript *itself* has nothing built in for handling query string parameters. 


Code running in a (modern) browser you can use the [`URL` object](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) (which is part of the APIs provided by browsers to JS):





```
var url_string = "http://www.example.com/t.html?a=1&b=3&c=m2-m3-m4-m5"; //window.location.href
var url = new URL(url_string);
var c = url.searchParams.get("c");
console.log(c);
```









For older browsers (including Internet Explorer), you can use [this polyfill](https://github.com/ungap/url-search-params) or the code from the original version of this answer that predates `URL`:


You could access `location.search`, which would give you from the `?` character on to the end of the URL or the start of the fragment identifier (#foo), whichever comes first.


Then you can parse it with this:





```
function parse_query_string(query) {
  var vars = query.split("&");
  var query_string = {};
  for (var i = 0; i < vars.length; i++) {
    var pair = vars[i].split("=");
    var key = decodeURIComponent(pair[0]);
    var value = decodeURIComponent(pair[1]);
    // If first entry with this name
    if (typeof query_string[key]  "undefined") {
      query_string[key] = decodeURIComponent(value);
      // If second entry with this name
    } else if (typeof query_string[key]  "string") {
      var arr = [query_string[key], decodeURIComponent(value)];
      query_string[key] = arr;
      // If third or later entry with this name
    } else {
      query_string[key].push(decodeURIComponent(value));
    }
  }
  return query_string;
}

var query_string = "a=1&b=3&c=m2-m3-m4-m5";
var parsed_qs = parse_query_string(query_string);
console.log(parsed_qs.c);
```




You can get the query string from the URL of the current page with:



```
var query = window.location.search.substring(1);
var qs = parse_query_string(query);

``` <http://code.djangoproject.com/wiki/CookBookNewformsAdminAndUser>


Involves implementing save methods on your ModelAdmin objects. pretty simple to do, just select the tabs element which currently has no style to it. add a style and click the center align button for typography. easy peezy. Lets say you want to send a table with a single column of GUIDs.


First we need to create a structure using [SqlMetaData](https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.server.sqlmetadata(v=vs.110).aspx) which represents the schema of the table (columns).



```
var tableSchema = new List<SqlMetaData>(1)
{
  new SqlMetaData("Id", SqlDbType.UniqueIdentifier)
}.ToArray();

```

Next you create a list of records that match the schema using [SqlDataRecord](https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.server.sqldatarecord(v=vs.110).aspx).



```
var tableRow = new SqlDataRecord(tableSchema);
tableRow.SetGuid(0, Guid.NewGuid());
var table = new List<SqlDataRecord>(1)
{
  tableRow
};

```

Then create the [SqlParameter](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter(v=vs.110).aspx):



```
var parameter = new SqlParameter();
parameter.SqlDbType = SqlDbType.Structured;
parameter.ParameterName = "@UserIds";
parameter.Value = table;

var parameters = new SqlParameter[1]
{
  parameter
};

```

Then simply call the stored procedure by using the [Database.SqlQuery](https://msdn.microsoft.com/en-us/library/gg696545(v=vs.113).aspx).



```
IEnumerable<ReturnType> result;
using (var myContext = new DbContext())
{
  result = myContext.Database.SqlQuery<User>("GetUsers", parameters)
    .ToList();         // calls the stored procedure
    // ToListAsync();  // Async
{

```

In SQL Server, create your User-Defined Table Type (I suffix them with TTV, Table Typed Value):



```
CREATE TYPE [dbo].[UniqueidentifiersTTV] AS TABLE(
  [Id] [uniqueidentifier] NOT NULL
)
GO

```

Then specify the type as a parameter (don't forget, Table Type Values have to be readonly!):



```
CREATE PROCEDURE [dbo].[GetUsers] (
  @UserIds [UniqueidentifiersTTV] READONLY
) AS
BEGIN
  SET NOCOUNT ON

  SELECT u.* -- Just an example :P
  FROM [dbo].[Users] u
  INNER JOIN @UserIds ids On u.Id = ids.Id
END

```