purelynx
purelynx

Reputation: 21

Filling a form (caolan) with default values in node.js

I am using caolan forms with node.js. My schema looks like:

var News = new Schema({
  name : String
, index: Number
});

My form has 3 news fields:

var news = forms.create({ news_1: fields.string({required: true}),
                          news_2: fields.string({required: true}),
                          news_3: fields.string({required: true})              
                       });

I now try to fill this form with default values which is where I need help. What am I doing wrong in the following code?

news.bind({news_1: "test1", news_2: "test2", news_3: "test3"});

Thanks.

Upvotes: 2

Views: 410

Answers (1)

janki
janki

Reputation: 101

You can create form with this object

{ 
  news_1: fields.string({required: true, value : 'test1'}),
  news_2: fields.string({required: true, value : 'test2'}),
  news_3: fields.string({required: true, value : 'test3'})              
}

Upvotes: 4

Related Questions