summaryrefslogtreecommitdiff
path: root/render/form.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2005-05-11 02:03:15 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2005-05-11 02:03:15 +0000
commit6257ee1fecd985ceba2e26a1269020a8662d4c43 (patch)
tree070678fcb9bb62de40306c2c454e8237ac08fbcc /render/form.c
parent303f214df70c72f662383a28f43eaf3137934dd3 (diff)
downloadnetsurf-6257ee1fecd985ceba2e26a1269020a8662d4c43.tar.gz
netsurf-6257ee1fecd985ceba2e26a1269020a8662d4c43.tar.bz2
[project @ 2005-05-11 02:03:15 by jmb]
Correctly handle submitting forms via pressing return in a text input (the first declared submit button should be used) svn path=/import/netsurf/; revision=1719
Diffstat (limited to 'render/form.c')
-rw-r--r--render/form.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/render/form.c b/render/form.c
index 557e485af..ea7289934 100644
--- a/render/form.c
+++ b/render/form.c
@@ -11,6 +11,7 @@
*/
#include <assert.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "curl/curl.h"
@@ -191,6 +192,7 @@ bool form_successful_controls(struct form *form,
struct form_option *option;
struct form_successful_control sentinel, *last_success, *success_new;
char *value;
+ bool had_submit = false;
last_success = &sentinel;
sentinel.next = 0;
@@ -344,9 +346,13 @@ bool form_successful_controls(struct form *form,
}
case GADGET_SUBMIT:
- /* only the activated submit button is
- * successful */
- if (control != submit_button)
+ if (!submit_button && !had_submit)
+ /* no submit button specified, so
+ * use first declared in form */
+ had_submit = true;
+ else if (control != submit_button)
+ /* only the activated submit button
+ * is successful */
continue;
value = strdup(control->value);
if (!value) {