webform

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0c5b02f4e27bb9a46dec39d315ec110769b49ef9
parent 9b15bb793ef591bcb96422d7c747ec5067442b96
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue, 23 Jul 2024 17:54:46 +0900

delete commas from html tag

Diffstat:
Mmain.go | 18+++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/main.go b/main.go @@ -59,10 +59,10 @@ func (q *Question) HTML() string { html := fmt.Sprintf("<fieldset>\n<legend>%s</legend>\n", q.Q) for n, a := range q.CheckList { id := q.Qid + strconv.Itoa(n) - html += fmt.Sprintf("<input type=\"checkbox\" name=\"%s\", id=\"%s\" value=\"%d\">\n"+ + html += fmt.Sprintf("<input type=\"checkbox\" name=\"%s\" id=\"%s\" value=\"%d\">\n"+ "<label for=\"%s\">%s</label>\n", q.Qid, id, n, id, a) if a == "その他" { - html += fmt.Sprintf("<input type=\"text\" name=\"%s_other\", id=\"%s_other\">\n", q.Qid, id) + html += fmt.Sprintf("<input type=\"text\" name=\"%s_other\" id=\"%s_other\">\n", q.Qid, q.Qid) } } html += "</fieldset>\n" @@ -71,17 +71,17 @@ func (q *Question) HTML() string { html := fmt.Sprintf("<fieldset>\n<legend>%s</legend>\n", q.Q) for n, a := range q.RadioList { id := q.Qid + strconv.Itoa(n) - html += fmt.Sprintf("<input type=\"radio\" name=\"%s\", id=\"%s\" value=\"%d\">\n"+ + html += fmt.Sprintf("<input type=\"radio\" name=\"%s\" id=\"%s\" value=\"%d\">\n"+ "<label for=\"%s\">%s</label>\n", q.Qid, id, n, id, a) if a == "その他" { - html += fmt.Sprintf("<input type=\"text\" name=\"%s_other\", id=\"%s_other\">\n", q.Qid, id) + html += fmt.Sprintf("<input type=\"text\" name=\"%s_other\" id=\"%s_other\">\n", q.Qid, q.Qid) } } html += "</fieldset>\n" return html case "text": return fmt.Sprintf("<fieldset>\n<legend>%s</legend>\n"+ - "<textarea name=\"%s\", id=\"%s\"></textarea></fieldset>", + "<textarea name=\"%s\" id=\"%s\"></textarea></fieldset>", q.Q, q.Qid, q.Qid) default: panic(fmt.Sprintf("unknown question type: %s\n", q.T)) @@ -179,10 +179,6 @@ type CheckAns struct { } func (a CheckAns) qid() string { return a.Qid } -func formatAns(q Part, ans map[string][]string) ([]byte, error) { - return nil, nil -} - var Q Part = Part{ Q: "きのかわ弦楽合奏団第7回定期演奏会 アンケート", Ent: []Entry{ @@ -246,9 +242,9 @@ var bufc = make(chan []byte) func main() { f, err := os.Create("a.json") if err != nil { - log.Fatal("create file: %v\n", err) + log.Fatalf("create file: %v\n", err) } - intc := make(chan os.Signal) + intc := make(chan os.Signal, 3) done := make(chan struct{}) listenErrChan := make(chan struct{}) signal.Notify(intc, os.Interrupt)