From: Nicolas Graner <nicolas.graner@universite-paris-saclay.fr>
To: 43542@debbugs.gnu.org
Subject: bug#43542: EWW should default checkbox value to "on"
Date: Mon, 21 Sep 2020 02:00:48 +0200 [thread overview]
Message-ID: <871riwrob3.fsf@hypra-graner> (raw)
In EWW, when a <input type="checkbox"> has no 'value' attribute, when it
is checked, its value is taken as nil (empty). According to HTML
specification, it should be taken as "on".
Example:
--------------------------------------------------
<form action="foo" method="get">
<input type="checkbox" name="box1" value="bar" checked="checked">
<input type="checkbox" name="box2" checked="checked">
<input type="submit">
</form>
--------------------------------------------------
If you open the above file and hit "submit", the request is:
foo?box2=&box1=bar
instead of:
foo?box2=on&box1=bar
Suggested patch:
--------------------------------------------------
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 8918be0d2e..55eded6ce6 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1634,7 +1634,7 @@ eww-submit
(cond
((member (plist-get input :type) '("checkbox" "radio"))
(when (plist-get input :checked)
- (push (cons name (plist-get input :value))
+ (push (cons name (or (plist-get input :value) "on"))
values)))
((equal (plist-get input :type) "file")
(when-let ((file (plist-get input :filename)))
--------------------------------------------------
Nicolas.
next reply other threads:[~2020-09-21 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 0:00 Nicolas Graner [this message]
2020-09-21 11:59 ` bug#43542: EWW should default checkbox value to "on" Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871riwrob3.fsf@hypra-graner \
--to=nicolas.graner@universite-paris-saclay.fr \
--cc=43542@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).