1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-07 02:30:18 +00:00

fix the test fun for pull request 873

This commit is contained in:
astaxie
2014-10-20 22:23:29 +08:00
parent dbf944adce
commit 710f5b6234
2 changed files with 14 additions and 13 deletions

View File

@ -381,18 +381,18 @@ func RenderForm(obj interface{}) template.HTML {
// renderFormField returns a string containing HTML of a single form field.
func renderFormField(label, name, fType string, value interface{}, id string, class string) string {
if id != "" {
id = "id=\"" + id + "\""
id = " id=\"" + id + "\""
}
if class != "" {
class = "class=\"" + class + "\""
class = " class=\"" + class + "\""
}
if isValidForInput(fType) {
return fmt.Sprintf(`%v<input %v %v name="%v" type="%v" value="%v">`, label, id, class, name, fType, value)
return fmt.Sprintf(`%v<input%v%v name="%v" type="%v" value="%v">`, label, id, class, name, fType, value)
}
return fmt.Sprintf(`%v<%v %v %v name="%v">%v</%v>`, label, fType, id, class, name, value, fType)
return fmt.Sprintf(`%v<%v%v%v name="%v">%v</%v>`, label, fType, id, class, name, value, fType)
}
// isValidForInput checks if fType is a valid value for the `type` property of an HTML input element.