writeln!(output, "");
match e.etype.as_str() {
- "zak_form_cgi_form_element_text" => { writeln!(output, r#"let mut fi = zakform::fields::FieldText::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_text_area" => { writeln!(output, r#"let mut fi = zakform::fields::FieldTextArea::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_radio" => { writeln!(output, r#"let mut fi = zakform::fields::FieldRadio::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_select" => { writeln!(output, r#"let mut fi = zakform::fields::FieldSelect::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_check" => { writeln!(output, r#"let mut fi = zakform::fields::FieldCheck::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_submit" => { writeln!(output, r#"let mut fi = zakform::fields::FieldButton::new("{}")"#, e.id); },
- "zak_form_cgi_form_element_file" => { writeln!(output, r#"let mut fi = zakform::fields::FieldFile::new("{}")"#, e.id); },
+ "zak_form_cgi_form_element_text" => { writeln!(output, r#"let mut fi = zakform::fields::FieldText::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_text_area" => { writeln!(output, r#"let mut fi = zakform::fields::FieldTextArea::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_radio" => { writeln!(output, r#"let mut fi = zakform::fields::FieldRadio::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_select" => { writeln!(output, r#"let mut fi = zakform::fields::FieldSelect::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_check" => { writeln!(output, r#"let mut fi = zakform::fields::FieldCheck::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_submit" => { writeln!(output, r#"let mut fi = zakform::fields::FieldButton::new("{}");"#, e.id); },
+ "zak_form_cgi_form_element_file" => { writeln!(output, r#"let mut fi = zakform::fields::FieldFile::new("{}");"#, e.id); },
_ => { continue; },
};
};
if e.placeholder != "" {
- writeln!(output, r#"fi.set_placeholder("{}");"#, e.placeholder);
+ writeln!(output, r#"fi.set_placeholder(&String::from("{}"));"#, e.placeholder);
}
if e.class != "" {
writeln!(output, r#"fi.set_class("{}");"#, e.class);
};
}
- writeln!(output, "f.add_field(Box::new(fi);");
+ writeln!(output, "f.add_field(Box::new(fi));");
}
writeln!(output, "");