Mercurial Hosting > disearch
diff src/lib/Shared.luan @ 12:3e2cb946d511
form handling
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 30 Oct 2023 14:59:45 -0600 |
parents | 62dd23f0b549 |
children | af2b95854072 |
line wrap: on
line diff
--- a/src/lib/Shared.luan Sun Oct 29 22:39:31 2023 -0600 +++ b/src/lib/Shared.luan Mon Oct 30 14:59:45 2023 -0600 @@ -1,6 +1,8 @@ local Luan = require "luan:Luan.luan" local error = Luan.error local Time = require "luan:Time.luan" +local Parsers = require "luan:Parsers.luan" +local json_string = Parsers.json_string or error() local Http = require "luan:http/Http.luan" @@ -58,4 +60,10 @@ return request.scheme.."://"..request.headers["Host"].."/login2.html" end +function Shared.js_error(field,message) +%> + showError( context.form, '<%=field%>', <%=json_string(message)%> ); +<% +end + return Shared