mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
bug 955 continued: Do not call onsubmit for a BUTTON, either.
Added tricky code for calling submit() from onclick() of BUTTON.
This commit is contained in:
parent
820afbee0b
commit
ba24e154e2
@ -1383,7 +1383,21 @@ submit_given_form(struct session *ses, struct document_view *doc_view,
|
|||||||
void
|
void
|
||||||
delayed_submit_given_form(struct delayed_submit_form *dsf)
|
delayed_submit_given_form(struct delayed_submit_form *dsf)
|
||||||
{
|
{
|
||||||
|
int button = 0;
|
||||||
|
struct form_control *fc;
|
||||||
|
|
||||||
|
/* Stupid workaround for button's onclick="submit();" */
|
||||||
|
if (!list_empty(dsf->form->items)) {
|
||||||
|
fc = (struct form_control *)dsf->form->items.next;
|
||||||
|
|
||||||
|
if (fc->type == FC_BUTTON) {
|
||||||
|
fc->type = FC_SUBMIT;
|
||||||
|
button = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
submit_given_form(dsf->ses, dsf->vs->doc_view, dsf->form, 0);
|
submit_given_form(dsf->ses, dsf->vs->doc_view, dsf->form, 0);
|
||||||
|
if (button)
|
||||||
|
fc->type = FC_BUTTON;
|
||||||
mem_free(dsf);
|
mem_free(dsf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ call_onsubmit_and_submit(struct session *ses, struct document_view *doc_view,
|
|||||||
* explicitly tell the ECMAScript code which of them was
|
* explicitly tell the ECMAScript code which of them was
|
||||||
* pressed. W3C DOM Level 3 doesn't seem to include such a
|
* pressed. W3C DOM Level 3 doesn't seem to include such a
|
||||||
* feature. */
|
* feature. */
|
||||||
if (fc->type != FC_RESET && fc->form->onsubmit) {
|
if (fc->type != FC_RESET && fc->type != FC_BUTTON && fc->form->onsubmit) {
|
||||||
struct string code;
|
struct string code;
|
||||||
|
|
||||||
if (init_string(&code)) {
|
if (init_string(&code)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user