all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43542: EWW should default checkbox value to "on"
@ 2020-09-21  0:00 Nicolas Graner
  2020-09-21 11:59 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Graner @ 2020-09-21  0:00 UTC (permalink / raw)
  To: 43542

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.





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#43542: EWW should default checkbox value to "on"
  2020-09-21  0:00 bug#43542: EWW should default checkbox value to "on" Nicolas Graner
@ 2020-09-21 11:59 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-21 11:59 UTC (permalink / raw)
  To: Nicolas Graner; +Cc: 43542

Nicolas Graner <nicolas.graner@universite-paris-saclay.fr> writes:

> Suggested patch:

Thanks; applied to Emacs 28.

I forget if I've asked you this before -- this patch was small enough to
apply without a copyright assignment, but in case there's more patches
in the future, an assignment might be necessary.  So it might be a good
idea to start that process now -- would you be willing to assign the
copyright on Emacs patches to the FSF?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-21 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-21  0:00 bug#43542: EWW should default checkbox value to "on" Nicolas Graner
2020-09-21 11:59 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.