Bananas Development Blog: share your thoughts

Formular button via JS auslösen

Man kann ja ein Formular ja via JavaScript absenden:
document.forname.submit();


So nun ist aber komischer weise, der Absendeknopf dann nicht in dem POST enthalten.

Ich verwende den button tag und nicht den input tag für den Absende Knopf, daher kann es sein, dass der input tag dann trotzdem vorhanden ist.

Nur wenn ich diesen nun auch drücke, dann ist diese in POST enthalten.

Nun gibt es aber auch eine Lösung die wirklich das drücken des Knopfes via JS nachmacht und zwar so als hätte der Benutzer wirklich darauf gedrückt.
document.getElementById('submitButton').click();


Somit ist auch der Button im POST enthalten und mann kann diesen abfragen.

Banana
out.
  • No comments

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Trackbacks / Pingbacks

  • No Trackbacks