]> git.joonet.de Git - adminer.git/commitdiff
Require length when changing type from char to varchar
authorJakub Vrana <jakub@vrana.cz>
Mon, 8 Jul 2013 16:59:43 +0000 (09:59 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 8 Jul 2013 17:23:49 +0000 (10:23 -0700)
adminer/static/editing.js

index 111b5b38b41eb28eda06cb36812dcdf19e94183b..17ff18937c3bf0f3c9fce19e02f5ff4659bbecc9 100644 (file)
@@ -355,12 +355,14 @@ function editingTypeChange(type) {
        var text = selectValue(type);
        for (var i=0; i < type.form.elements.length; i++) {
                var el = type.form.elements[i];
-               if (el.name == name + '[length]' && !(
-                       (/(char|binary)$/.test(lastType) && /(char|binary)$/.test(text))
-                       || (/(enum|set)$/.test(lastType) && /(enum|set)$/.test(text))
-               )) {
+               if (el.name == name + '[length]') {
                        el.required = /var(char|binary)$/.test(text);
-                       el.value = '';
+                       if (!(
+                               (/(char|binary)$/.test(lastType) && /(char|binary)$/.test(text))
+                               || (/(enum|set)$/.test(lastType) && /(enum|set)$/.test(text))
+                       )) {
+                               el.value = '';
+                       }
                }
                if (lastType == 'timestamp' && el.name == name + '[has_default]' && /timestamp/i.test(formField(type.form, name + '[default]').value)) {
                        el.checked = false;