let mut f = zakform::form::Form::new();
let mut fi = zakform::fields::FieldText::new("text");
+ fi.set_maxlen(10);
f.add_field(Box::new(fi));
let mut fi = zakform::fields::FieldRadio::new("radio");
f.add_field(Box::new(fi));
let mut fi = zakform::fields::FieldTextArea::new("textarea");
+ fi.set_rows(15);
f.add_field(Box::new(fi));
let fs = f.fields();
f
}
+
+ pub fn set_maxlen(&mut self, maxlen: i32) {
+ self.maxlen = maxlen;
+ }
+
+ pub fn maxlen(&self) -> i32 {
+ self.maxlen
+ }
}
#[derive(Default)]
f
}
+
+ pub fn set_maxlen(&mut self, maxlen: i32) {
+ self.maxlen = maxlen;
+ }
+
+ pub fn maxlen(&self) -> i32 {
+ self.maxlen
+ }
+
+ pub fn set_rows(&mut self, rows: i32) {
+ self.rows = rows;
+ }
+
+ pub fn rows(&self) -> i32 {
+ self.rows
+ }
}
#[derive(Serialize)]