예제 #1
0
static 
#if HAVE_SWIFTEN_3
FormField::ref
#else
HiddenFormField::ref
#endif
createHiddenField(const std::string &name, const std::string &value) {
#if HAVE_SWIFTEN_3
	FormField::ref field = SWIFTEN_SHRPTR_NAMESPACE::make_shared<FormField>(FormField::HiddenType, value);
#else
	HiddenFormField::ref field = HiddenFormField::create();
	field->setValue(value);
#endif
	field->setName(name);
	return field;
}
예제 #2
0
static 
#if HAVE_SWIFTEN_3
FormField::ref
#else
TextSingleFormField::ref
#endif
createTextSingleField(const std::string &name, const std::string &value, const std::string &label, bool required) {
#if HAVE_SWIFTEN_3
	FormField::ref field = SWIFTEN_SHRPTR_NAMESPACE::make_shared<FormField>(FormField::TextSingleType, value);
#else
	TextSingleFormField::ref field = TextSingleFormField::create();
	field->setValue(value);
#endif
	field->setName(name);
	field->setLabel(label);
	field->setRequired(required);
	return field;
}
예제 #3
0
static 
#if HAVE_SWIFTEN_3
FormField::ref
#else
ListSingleFormField::ref
#endif
createListSingleField(const std::string &name, Swift::FormField::Option value, const std::string &label, const std::string &def, bool required) {
#if HAVE_SWIFTEN_3
	FormField::ref field = SWIFTEN_SHRPTR_NAMESPACE::make_shared<FormField>(FormField::ListSingleType);
#else
	ListSingleFormField::ref field = ListSingleFormField::create();
#endif
	field->setName(name);
	field->setLabel(label);
	field->addOption(value);
#if HAVE_SWIFTEN_3
	field->addValue(def);
#else
	field->setValue(def);
#endif
	return field;
}