s.push_str(fi.render().as_str());
}
- let mut single = f.get_field("radio").unwrap().any().downcast_ref::<zakform::fields::FieldRadio>().unwrap();
+ let mut single = f.get_field("radio").unwrap().any().downcast_mut::<zakform::fields::FieldRadio>().unwrap();
- /*single.add_option(zakform::fields::FOption{ value: String::from("X"), label: String::from("Unknown") });
+ single.add_option(zakform::fields::FOption{ value: String::from("X"), label: String::from("Unknown") });
let single = f.get_field("radio").unwrap().any().downcast_ref::<zakform::fields::FieldRadio>().unwrap();
- let ssingle = single.render_single(2);*/
- let ssingle = single.render_single(1);
+ s.push_str(&single.render_single(2));
- s.push_str(&ssingle);
+ s.push_str(&single.render_single(1));
s.push_str(r#"<button type="submit">Send</button>"#);
fn render(&self) -> String;
- fn any(&self) -> &dyn Any;
+ fn any(&mut self) -> &mut dyn Any;
}
#[derive(Default)]
s
}
- fn any(&self) -> &dyn Any {
+ fn any(&mut self) -> &mut dyn Any {
self
}
}
s
}
- fn any(&self) -> &dyn Any {
+ fn any(&mut self) -> &mut dyn Any {
self
}
}
&self.fields
}
- pub fn get_field(&self, field_name: &str) -> Result<&Box<dyn super::fields::TField>, ()> {
- for f in &self.fields {
+ pub fn get_field(&mut self, field_name: &str) -> Result<&mut Box<dyn super::fields::TField>, ()> {
+ for f in &mut self.fields {
if f.get_name().as_str() == field_name {
return Ok(f);
}