Alert user when not specied length for CHAR/VARCHAR fields.

This commit is contained in:
Michal Čihař
2003-06-25 15:51:56 +00:00
parent b4d6211261
commit d2a95f306a
3 changed files with 23 additions and 2 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2003-06-25 Michal Cihar <nijel@users.sourceforge.net> 2003-06-25 Michal Cihar <nijel@users.sourceforge.net>
* libraries/sqlparser.lib.php3: Fixed XSS problem. * libraries/sqlparser.lib.php3: Fixed XSS problem.
* tbl_properties.inc.php3, libraries/functions.js: Alert user when not
specied length for CHAR/VARCHAR fields.
2003-06-24 Marc Delisle <lem9@users.sourceforge.net> 2003-06-24 Marc Delisle <lem9@users.sourceforge.net>
* sql.php3, bug 759568, row count, DISTINCT and MySQL 4 * sql.php3, bug 759568, row count, DISTINCT and MySQL 4

View File

@@ -246,6 +246,25 @@ function checkFormElementInRange(theForm, theFieldName, min, max)
return true; return true;
} // end of the 'checkFormElementInRange()' function } // end of the 'checkFormElementInRange()' function
function checkTableEditForm(theForm, fieldsCnt)
{
for (i=0; i<fieldsCnt; i++)
{
var id = "field_" + i + "_2";
var elm = getElement(id);
if (elm.value == 'VARCHAR' || elm.value == 'CHAR') {
elm2 = getElement("field_" + i + "_3")
val = parseInt(elm2.value);
if (isNaN(val)) {
elm2.select();
alert(errorMsg1);
elm2.focus();
return false;
}
}
}
} // enf of the 'checkTableEditForm()' function
/** /**
* Ensures the choice between 'transmit', 'zipped', 'gzipped' and 'bzipped' * Ensures the choice between 'transmit', 'zipped', 'gzipped' and 'bzipped'

View File

@@ -18,7 +18,7 @@ document.onkeydown = onKeyDownArrowsHandler;
</script> </script>
<?php } ?> <?php } ?>
<form method="post" action="<?php echo $action; ?>"> <form method="post" action="<?php echo $action; ?>" onsubmit="checkTableEditForm(this, <?php echo $num_fields; ?>)" >
<?php <?php
echo PMA_generate_common_hidden_inputs($db, $table); echo PMA_generate_common_hidden_inputs($db, $table);
if ($action == 'tbl_create.php3') { if ($action == 'tbl_create.php3') {
@@ -656,4 +656,4 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'])
</table> </table>
<br /> <br />
<center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center> <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>