Is onsubmit being called for reset buttons too?
Kalle Olavi Niemitalo <[email protected]>
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
I haven't compiled ELinks with CONFIG_ECMASCRIPT yet, but the code that calls the onsubmit script seems to be in the wrong place. It is now (commit 6fe1a431f1ce4614c31eb4fcfe9d088c7a2c42f6) in call_onsubmit_and_submit() in src/viewer/text/link.c. goto_current_link() calls that if link_is_form(link) returns true. Then, call_onsubmit_and_submit() executes the onsubmit script if any, and calls get_form_uri() in src/viewer/text/form.c. It in turn checks whether fc->type is FC_RESET or something else. So, it looks like the onsubmit script is being run even for FC_RESET. I suppose the onsubmit code should be called from get_form_uri(), after it has checked that fc->type == FC_SUBMIT. And then, a "side_effects_ok" parameter should be added in get_form_uri() and get_link_uri(), so that calls from e.g. pass_uri_to_command() or copy_current_link_to_clipboard() won't run any scripts or reset the form. _______________________________________________ elinks-dev mailing list [email protected] http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc
(application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD7ELrHm9IGt60eMgRAnoCAJ9YgnY6PIz2rTJkbmh6i5vcIw+kxwCgjQjK TRUiO1lFSmhIs6C2c3Etzs0= =3+8i -----END PGP SIGNATURE-----