webform

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

commit 9e471a6dabf9edd2d5734f57b9f9c7b06c2029dc
parent 64077a1b9171d2182764f066e09be97ce694c680
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sun, 21 Jul 2024 09:02:59 +0900

add structs for answer

Diffstat:
Mmain.go | 27+++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/main.go b/main.go @@ -52,9 +52,9 @@ func (p *Part) copy() Entry { } type Question struct { - Q string - Qid string - T string // answer type: "text", "radio", "check" + Q string + Qid string + T string // answer type: "text", "radio", "check" TextAns string RadioList []string RadioAns string @@ -63,6 +63,7 @@ type Question struct { OtherAns string } + func (*Question) isPart() bool { return false } func (q *Question) HTML() string { switch q.T { @@ -164,6 +165,24 @@ func (q *Question) copy() Entry { return qq } +type Ans interface { +} + +type TextAns struct { + Qid string + Ans string +} + +type RadioAns struct{ + Qid string + Ans string +} + +type CheckAns struct{ + Qid string + Ans []string +} + var Q Part = Part{ Q: "きのかわ弦楽合奏団第7回定期演奏会 アンケート", Ent: []Entry{ @@ -252,7 +271,7 @@ func handler(w http.ResponseWriter, r *http.Request) { } bufc <- q } else { - fmt.Fprint(w, header + Q.HTML() + footer) + fmt.Fprint(w, header+Q.HTML()+footer) } }