0
good evening. I’m having a problem submitting a form, typing Enter returns the error: php’s "Undefined Index". However, if I click the Login button, it normally submits.
< script type = "text/javascript" >
$(function() {
$('.form').form({
fields: {
usuario: {
identifier: 'usuario',
rules: [{
type: 'empty',
prompt: 'Preencha o campo Usuário!'
}]
},
senha: {
identifier: 'senha',
rules: [{
type: 'empty',
prompt: 'Preencha o campo Senha!'
}]
}
}
});
}); <
/script>
* {
margin: 0px;
padding: 0px;
border: none;
outline: none !important;
}
body {
background-color: #f4f4f4 !important;
}
.login-alerts {
width: 350;
height: 50px;
margin: 0 auto;
}
.login-center {
width: 350px;
height: auto;
background-color: #ffffff;
margin: 0 auto;
margin-top: 8%;
box-shadow: 1px 2px 8px 1px #d6d6d6;
border-radius: 6px;
}
.login-logo {
padding: 20px 0px 0px 20px;
}
.login {
padding: 10px 20px 20px 20px;
}
<link href="https://raw.githubusercontent.com/Semantic-Org/Semantic-UI/master/dist/semantic.min.css" rel="stylesheet" />
<script src="https://raw.githubusercontent.com/Semantic-Org/Semantic-UI/master/dist/semantic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<body>
<div class="login-center">
<div class="login-top">
<div class="login-logo"><img src="assets/img/sigio-logo.svg" width="150"></div>
</div>
<div class="login">
<form class="ui form error" action="" method="POST">
<div class="field ui fluid left icon input">
<input type="text" placeholder="Usuário" id="usuario" name="usuario" maxlength="15">
<i class="user icon"></i>
</div>
<div class="field ui fluid left icon input">
<input type="password" placeholder="Senha" id="senha" name="senha" maxlength="25">
<i class="lock icon"></i>
</div>
<div class="field">
<input type="submit" class="fluid ui primary button" name="logar" value="Logar">
</div>
<div class="ui error message"></div>
</form>
</div>
</div>
</body>
</html>
You should also put the PHP code, after all the error is in it. Ps.: To fix add the field
logar
in the Javascript.– Valdeir Psr