Skip to content

Instantly share code, notes, and snippets.

@imsickofmaps
Created August 6, 2013 10:18
Show Gist options
  • Select an option

  • Save imsickofmaps/6163368 to your computer and use it in GitHub Desktop.

Select an option

Save imsickofmaps/6163368 to your computer and use it in GitHub Desktop.
self.add_state(new FreeText(
"reg_school_classrooms",
"reg_school_teachers",
"How many classrooms do you have in your school?"
));
self.add_creator('reg_school_teachers', function(state_name, im) {
var input = parseInt(im.get_user_answer('reg_school_classrooms'));
if (!isNaN(input)) {
return new FreeText(
"reg_school_teachers",
"reg_school_teachers_g1",
"How many teachers in total do you have in your school?"
);
} else {
return self.make_bad_data_state(
'reg_school_classrooms_error',
'reg_school_classrooms',
'a number');
}
});
self.add_creator('reg_school_classrooms_error', function(state_name, im) {
return self.make_bad_data_state(
'reg_school_classrooms_error',
'reg_school_classrooms',
'a number');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment