Jump to the first form error

This commit is contained in:
TEC 2022-10-02 16:29:57 +08:00
parent 12c70de07f
commit 3581bdb3a3
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
2 changed files with 2 additions and 2 deletions

View File

@ -137,7 +137,7 @@ function submit(forminfo::Dict; backpage::Bool=false)
Genie.Renderer.redirect("/survey?uid=$uid_str&page=$(response.page)")
else
save!(response, SURVEY[page])
Genie.Renderer.redirect("/survey?uid=$uid_str&page=$page")
Genie.Renderer.redirect("/survey?uid=$uid_str&page=$page#formerror")
end
else
io = IOBuffer()

View File

@ -633,7 +633,7 @@ function htmlrender(q::Question, a::Answer)
if isvalid(a)
htmlrender(q, a.value, false)
else
string(elem("small", a.error, :class => "formerror"),
string(elem("small", a.error, :class => "formerror", :id => "formerror"),
htmlrender(q, a.value, string(!isnothing(a.error))))
end
end