I have a form (new poll form) in which I can add multiple items (poll questions) to a collection using KnockoutJS. I want to know how can I force the user to enter a value into the question textbox before he can add a new row…

var App = function (pollData, pollQuestionData) {
var self = this;
self.poll = new Poll(pollData);
self.questions = ko.observableArray([new PollQuestion(pollQuestionData)]); // Put one question in by defaul
// Add new question function... here should go validation I guess???
self.addQuestion = function () {
self.questions.push(new PollQuestion(pollQuestionData))
};
// Remove question function
self.removeQuestion = function (question) {
self.questions.remove(question)
};
};
Here is my jsfiddle code (that by the way I couldn’t make it run…)
Here is a fiddle that uses a computed observable to only show the
New Questionbutton when all questions have a value:http://jsfiddle.net/jearles/AcE2V/5/