From dbe02639ddeab36654276acd0205d3d300d70bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 6 Jan 2002 17:29:00 +0000 Subject: [PATCH] improved and fixed js stuff used with the new "null" checkbox --- ChangeLog | 8 ++++++-- tbl_change.php3 | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dd542bec..9344413f0 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,9 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-01-06 Loïc Chapeaux + * tbl_change.php3, lines 290-300: improved and fixed js stuff used with the + new "null" checkbox. + 2002-01-06 Marc Delisle - * libraries/display_tbl.lib.php3: typo thanks to - yrtimd at users.sourceforge.net + * libraries/display_tbl.lib.php3: typo thanks to + yrtimd at users.sourceforge.net 2001-01-05 Loïc Chapeaux * main.php3, line 234: maximum database name size is 64 characters. diff --git a/tbl_change.php3 b/tbl_change.php3 index 1f04ba417..8a329a825 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -287,7 +287,17 @@ for ($i = 0; $i < $fields_cnt; $i++) { if ($data == 'NULL') { echo ' checked="checked"'; } - echo ' onclick="if (this.checked) {document.forms[\'insertForm\'].elements[\'fields[' . urlencode($field) . ']\'].value = \'\'}; return true" />' . "\n"; + if (strstr($row_table_def['True_Type'], 'enum')) { + if (strlen($row_table_def['Type']) > 20) { + echo ' onclick="if (this.checked) {document.forms[\'insertForm\'].elements[\'field_' . md5($field) . '[]\'].selectedIndex = -1}; return true" />' . "\n"; + } else { + echo ' onclick="if (this.checked) {var elts = document.forms[\'insertForm\'].elements[\'field_' . md5($field) . '[]\']; var elts_cnt = elts.length; for (var i = 0; i < elts_cnt; i++ ) {elts[i].checked = false}}; return true" />' . "\n"; + } + } else if (strstr($row_table_def['True_Type'], 'set')) { + echo ' onclick="if (this.checked) {document.forms[\'insertForm\'].elements[\'field_' . md5($field) . '[]\'].selectedIndex = -1}; return true" />' . "\n"; + } else { + echo ' onclick="if (this.checked) {document.forms[\'insertForm\'].elements[\'fields[' . urlencode($field) . ']\'].value = \'\'}; return true" />' . "\n"; + } } else { echo '  ' . "\n"; }