File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "html"
88 "html/template"
99 "net/http"
10+ "reflect"
1011 "strconv"
1112 "strings"
1213 "time"
@@ -209,10 +210,19 @@ func (f *FormField) setOptionsFromSQL(sql *db.SQL) {
209210 queryRes , err := sql .All ()
210211 if err == nil {
211212 for _ , item := range queryRes {
212- f .Options = append (f .Options , FieldOption {
213- Value : fmt .Sprintf ("%v" , item [f .OptionTable .ValueField ]),
214- Text : fmt .Sprintf ("%v" , item [f .OptionTable .TextField ]),
215- })
213+ value := item [f .OptionTable .ValueField ]
214+ typeStr := reflect .TypeOf (value ).String ()
215+ if typeStr == "[]uint8" {
216+ f .Options = append (f .Options , FieldOption {
217+ Value : fmt .Sprintf ("%v" , string (value .([]uint8 ))),
218+ Text : fmt .Sprintf ("%v" , item [f .OptionTable .TextField ]),
219+ })
220+ } else {
221+ f .Options = append (f .Options , FieldOption {
222+ Value : fmt .Sprintf ("%v" , value ),
223+ Text : fmt .Sprintf ("%v" , item [f .OptionTable .TextField ]),
224+ })
225+ }
216226 }
217227 }
218228
You can’t perform that action at this time.
0 commit comments