Empeche de creer un mail vide avant le POST.

Code JS plus générique
This commit is contained in:
Alan Garcia 2012-10-26 13:56:14 +00:00
parent a30b73d2a3
commit 6bb88a40af
3 changed files with 10 additions and 11 deletions

View File

@ -203,3 +203,9 @@ function menu_toggle(id) {
$("#"+id).toggle(); $("#"+id).toggle();
} }
function false_if_empty(id,err_msg) {
if ( $("#"+id).val() == '' ) {
alert(err_msg);
return false;
}
}

View File

@ -70,7 +70,7 @@ if ($quota->cancreate("mail")) {
<form method="post" action="mail_doadd.php" id="main" name="mail_create"> <form method="post" action="mail_doadd.php" id="main" name="mail_create">
<input type="text" class="int intleft" style="text-align: right" name="mail_arg" value="<?php ehe($mail_arg); ?>" size="32" id="mail_arg" maxlength="255" /><span id="emaildom" class="int intright"><?php echo "@".$domain; ?></span> <input type="text" class="int intleft" style="text-align: right" name="mail_arg" value="<?php ehe($mail_arg); ?>" size="32" id="mail_arg" maxlength="255" /><span id="emaildom" class="int intright"><?php echo "@".$domain; ?></span>
<input type="hidden" name="domain_id" value="<?php echo $domain_id;?>" /> <input type="hidden" name="domain_id" value="<?php echo $domain_id;?>" />
<input type="submit" name="submit" class="inb" value="<?php __("Create this email address"); ?>" /> <input type="submit" name="submit" class="inb" value="<?php __("Create this email address"); ?>" onClick="return false_if_empty('mail_arg', '<?php echo addslashes(_("Can't have empty mail."));?>');" />
<?php }?> <?php }?>
<span class="inb"><a href="mail_manage_catchall.php?domain_id=<?php echo $domain_id?>"><?php __("Manage Catch-all for this domain");?></a></span> <span class="inb"><a href="mail_manage_catchall.php?domain_id=<?php echo $domain_id?>"><?php __("Manage Catch-all for this domain");?></a></span>
<?php if ($quota->cancreate("mail")) { ?> <?php if ($quota->cancreate("mail")) { ?>

View File

@ -99,21 +99,14 @@ for($i=0;$i<count($rdb);$i++) {
</tr> </tr>
</table> </table>
<br /> <br />
<input type="submit" class="inb" name="submit" value="<?php __("Create this new MySQL database."); ?>" onClick="return mysql_error_empty_suffix();" /> <input type="submit" class="inb" name="submit" value="<?php __("Create this new MySQL database."); ?>" onClick="return false_if_empty('dbn', '<?php echo addslashes(_("Can't have empty MySQL suffix"));?>');" />
</form> </form>
<?php <?php
} }
} }
?> ?>
<script type="text/javascript"> <script type="text/javascript">
document.forms['main'].pass.focus(); //document.forms['main'].pass.focus();
document.forms['main'].setAttribute('autocomplete', 'off'); //document.forms['main'].setAttribute('autocomplete', 'off');
function mysql_error_empty_suffix() {
if ( $("#dbn").val() == '' ) {
alert("<?php __("Error: empty database suffix.");?>");
return false;
}
}
</script> </script>
<?php include_once("foot.php"); ?> <?php include_once("foot.php"); ?>