Disable all original input fields when form is submitted.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 15 Jan 2011 22:07:33 +0000 (23:07 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 15 Jan 2011 22:07:33 +0000 (23:07 +0100)
This way only the generated input fields/textareas are submitted, and those
always contain the real value. Fixes #46.

src/main/resources/static/javascript/sone.js

index 80d039c..e0c8162 100644 (file)
@@ -47,6 +47,7 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op
                                textarea.show();
                        }
                        $(inputField.get(0).form).submit(function() {
+                               inputField.attr("disabled", "disabled");
                                if (!optional && (textarea.val() == "")) {
                                        return false;
                                }