Erro input radio formulário
2 participantes
Fórum dos Fóruns :: Ajuda e atendimento ao utilizador :: Questões sobre códigos :: Questões resolvidas sobre HTML e BBCode
Página 1 de 1
Erro input radio formulário
Detalhes da questão
Endereço do fórum: https://fbrsystem.forumeiros.com/h13-
Versão do fórum: AwesomeBB
Descrição
Provavelmente fiz algo de errado, acontece que quando marcado qualquer uma das opções do input de radio no formulário só aparece o valor do primeiro no texto
- Código:
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="csrf-token" content="7AvAsSd2Q3ojapRq531YspINWRFvXeCd6FZwunIn">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="vcapelli" content="Policia FBR">
<link rel="icon" href="https://imgur.com/0lcWT84.png">
<title>Polícia FBR: Desligamento</title>
<link href="https://dphsystem.com.br/css/font-dphsystem.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700;900&family=Roboto:wght@300;400;500;700;900&display=swap" rel="stylesheet">
<style>
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
body {
font-size: 17px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: normal;
line-height: 1.5;
color: #212121;
line-height: 1.5;
background: #fff;
}
/**
* Begin tipografia.
*/
a,
a:active,
a:link,
a:visited,
a:focus {
color: #007bff;
text-decoration: none;
border-bottom: solid 1px transparent;
outline: 0;
}
a:hover {
border-bottom-color: #2688dc;
}
a.fa:hover {
border-bottom-color: transparent;
color: #1f6db0;
}
h3 {
font-size: 20px;
font-weight: 200;
margin-bottom: 10px;
display: block;
width: 100%;
padding-bottom: 3px;
border-bottom: 2px solid #375e7f;
}
textarea {
height: 90px;
box-sizing: border-box;
resize: vertical;
outline: none;
}
.btn {
border: solid 1px #e4e4e4;
background: linear-gradient(180deg, #fff 0%, #efefef 100%);
padding: .575rem 1.1rem;
border-radius: .175rem;
font-weight: 600;
color: #686a6b;
cursor: pointer;
display: block;
text-align: center;
margin-bottom: 5px;
width: 100%;
}
.btn:focus {
border-color: #375e7f;
box-shadow: inset 0 -5px 40px rgba(120, 120, 120, 0.1), inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(0, 0, 0, 0.1);
outline: none;
}
.btn:hover {
box-shadow: inset 0 -100px rgba(108, 108, 108, 0.1);
}
.btn.btn-primary {
border-radius: 3px;
box-shadow: none;
color: #fff;
background: #007bff;
font-size: 14px;
transition: linear all 125ms;
margin-top: 32%;
}
.btn.btn-primary:focus {
border-color: #375e7f;
box-shadow: inset 0 1px 2px rgba(39, 56, 28, 0.075), 0 0 0 0.2em rgba(39, 56, 28, 0.6);
outline: none;
}
.btn.btn-primary:hover {
background: #444;
}
.btn.btn-danger {
color: #fff;
border-color: #bd2c00;
background: #e7592e;
background: linear-gradient(180deg, #f86b40 0%, #bd2c00 100%);
}
.btn.btn-danger:focus {
border-color: #aa2c05;
box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(197, 53, 9, 0.66);
outline: none;
}
.btn-progress {
cursor: not-allowed;
opacity: .657;
}
.form-control {
background-color: #fff;
border: 1px solid #d4d4d4;
padding: 6px 8px;
margin: 5px 0 0;
display: block;
width: 100%;
font-size: 16px;
color: #555;
line-height: 20px;
border-radius: 3px;
box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075);
outline: none;
}
.form-control:focus {
border-color: #4b6b35;
box-shadow: inset 0 1px 2px rgba(75, 107, 53, 0.075), 0 0 0 0.2em rgba(75, 107, 53, 0.6);
outline: none;
}
input[type="text"]:disabled {
background: #dddddd;
cursor: not-allowed;
}
.card {
background-color: #E54732;
padding: 5px;
font-size: 10px;
color: #fff;
font-weight: 800;
border-radius: 5px;
float: left;
margin-right: 5px;
}
/*
* End tipografia.
**/
.wrapper {
width: 50%;
position: absolute;
top: 5%;
left: 50%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
}
.wrapper hgroup {
text-align: center;
}
.wrapper hgroup i.fa {
font-size: 4em;
}
.wrapper hgroup h1 {
font-weight: 300;
margin: 10px 0;
padding: 0;
color: #545454;
}
.wrapper form {
margin: 0 0 25px;
padding: 20px;
color: #555;
background-color: #fff;
}
.wrapper form .form-group label {
display: table;
}
.wrapper form .form-group .form-group-col {
float: left;
margin-right: 2%;
margin-top: 2%;
margin-bottom: 2%;
}
.form-group .form-group-col:first-child {
margin-left: 3%;
}
.wrapper footer {
border: solid 1px #d6d6d6;
border-radius: 3px;
padding: 13px;
text-align: center;
font-size: 16px;
color: #555;
margin-bottom: 2%;
}
.col-94 {
width: 94%;
}
.col-30 {
width: 30%;
}
.col-46 {
width: 46%;
}
/**
* FOR JS Styles:
*/
#fa-generated-form,
footer {
box-shadow: 3px 3px 2px 0px rgba(0, 0, 0, 0.16);
}
.title h2 {
font-weight: 300;
margin-bottom: 5px;
text-align: center;
}
.title h4 {
font-weight: 300;
margin-bottom: 15px;
text-align: center;
}
@media screen and (max-width: 850px) {
.selected, .d-none{
width: 100%!important;
}
}
body{
display: block;
}
.menu{
position: relative;
z-index: 9;
color: #fff;
top: 0;
width: 100%;
display: block;
border-bottom: 1px solid #ddd;
}
.menu .top{
text-align: center;
font-family: Industry;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
padding: 8px;
background-color: #313a46;
border-bottom: 1px solid #ddd;
box-shadow: 0px 0px 2px 0px rgba(178, 188, 196, 0.5);
z-index: 1;
}
.menu .bot{
background-color: #fff;
padding: 16px 32px;
color: #333;
}
.menu .top h1{
font-size: 1.75em;
font-family: montserrat;
font-weight: 400;
margin: 0 12px;
}
.menu .bot h2{
font-size: 17px;
font-weight: 500;
}
.menu select{
overflow-y: auto;
background: transparent;
border: 0;
border: 1px solid #444;
margin-bottom: 6px;
padding: 2px 4px;
}
.menu option{
padding: 2px 5px;
color: #333;
}
.menu p{
font-size: 14px;
font-weight: 300;
}
.wrapper{
height: auto;
width: 100%;
margin: auto;
position: relative;
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: none;
}
.selected, .d-none {
width: 75%;
margin: auto;
}
#fa-generated-form{
box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
}
.selected{
display: block;
}
.d-none{
display: none;
}
.title h4{
font-weight: 700;
font-family: poppins;
font-size: 30px;
text-transform: uppercase;
}
textarea[name*="texto"]{
height: 200px;
}
.form-check:nth-child(1) {
margin-left: 0;
}
.form-check {
align-items: center;
margin: 0 4px;
}
.form-group-check, .form-check {
display: flex;
}
.form-check-input {
margin-right: 4px;
}
select {
border: 1px solid #d4d4d4!important;
padding: 6px 8px!important;
}
.form-group-check {
min-height: 36px;
}
</style>
<script>
$(document).ready(function() {
$('#config-primary').on('click', function() {
if( $('.config-secondary').css('visibility') == 'hidden' ) $('.config-secondary').css('visibility', 'visible');
else $('.config-secondary').css('visibility', 'hidden');
});
$('#select-form').on('change', function(e) {
var optionSelected = $(this).find(':selected');
var targetID = optionSelected[0].dataset.target;
// Aplicar classe d-none para div com classe selected
$('.selected').addClass('d-none');
// Remover classe selected da div com classe selected
$('.selected').removeClass('selected');
// Remover classe d-none para div com id target
$(targetID).removeClass('d-none');
// Aplicar classe selected para div com id target
$(targetID).addClass('selected');
});
});
</script>
</head>
<body>
<div class="menu">
<div class="bot">
<p>Em caso de dificuldades acesse o formulário direto <a href="/h13-">clique aqui!</a></p>
</div>
<div class="wrapper">
<div id="form" class="selected">
<form id="fa-generated-form1">
<div class="title">
<h4>Requerimento postagem aulas</h4>
</div>
<h3>Dados da aula</h3>
<div class="form-group" style="margin-bottom: 5%;">
<div class="form-group-col col-30">
<label for="campo1">Nick do professor:</label>
<input type="text" id="campo1" class="form-control" placeholder="Ex: Barbara:-P" required/>
</div>
<div class="form-group-col col-30">
<label for="campo2">Nick do aluno:</label>
<input type="text" id="campo2" class="form-control" placeholder="Ex: sNog" required/>
</div>
<div class="form-group-col col-30">
<label for="campo4">Situação:</label>
<div class="form-group-check">
<div class="form-check">
<input class="form-check-input" type="radio" id="campo4" value="Aprovado" checked>
<label class="form-check-label" for="campo4">
Aprovado
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="campo4" value="Reprovado">
<label class="form-check-label" for="campo4">
Reprovado
</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-group-col col-46">
<label for="campo3">Aula:</label>
<select data-type="select" class="form-control shadow-sm" id="campo3" required="">
<option value="Aula de Formação de Soldados">Aula de Formação de Soldados (AFS)</option>
<option value="Aula Prática de Comandos">Aula Prática de Comandos (APC)</option>
<option value="Escola de Formação de Cabos">Escola de Formação de Cabos (EFCb)</option>
<option value="Treino Prático de Cabos">Treino Prático de Cabos (TpC)</option>
<option value="Escola de Sargento das Armas">Escola de Sargento das Armas (ESA)</option>
<option value="Treino Prático de Sargentos">Treino Prático de Sargentos (TpS)</option>
<option value="Exame de Aptidão de Praças">Exame de Aptidão de Praças (EAP)</option>
</select>
</div>
<div class="form-group-col col-46">
<label for="campo5">Se reprovado, print's:</label>
<input type="text" id="campo5" class="form-control" placeholder=""/>
</div>
</div>
<br/>
<button type="submit" class="btn btn-primary">Enviar</button>
</form>
<!-- Javascript's -->
<!-- Não recomendada a edição abaixo desta linha. -->
<textarea style="display: none;" id="fa-generated-message1">[center][size=18][font=sans-serif]{{campo3}}[/font][/size][/center]
[b]Nick do professor:[/b] {{campo1}}
[b]Aula:[/b] {{campo3}}
[b]Nick do aluno:[/b] {{campo2}}
[b]Situação:[/b] {{campo4}}
[b]Se reprovado, prin's:[/b] {{campo5}}</textarea>
<input type="hidden" id="fa-generated-title1" value="{{campo2}}" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
<script src="https://forumeiros.github.io/assets/src/form-generator/form-replace.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.13/dist/sweetalert2.all.min.js"></script>
<script type="text/javascript">
(function ($) {
'use strict';
$(function () {
var $textarea = $('#fa-generated-message1');
var $title = $('#fa-generated-title1');
var $form = $('#fa-generated-form1');
$form.on('submit', function (event) {
if ($textarea.length === 0) {
event.preventDefault();
alert('[Erro Código 001 | Form Functions] Tente novamente!');
return false;
}
$textarea.val($textarea.val().replace(/\{\{campo(\d+)\}\}/gi, function (text, match) {
return $('#campo' + match).val();
}));
if ($title.length === 0) {
return;
}
$title.val($title.val().replace(/\{\{campo(\d+)\}\}/gi, function (text, match) {
return $('#campo' + match).val();
}));
});
});
}(jQuery));
</script>
<script type="text/javascript">
(function ($) {
'use strict';
$(window).on('load', function () {
$('#fa-generated-form1').on('submit', function (event) {
event.preventDefault();
$(this).find('button[type="submit"]').text('Postando...');
setTimeout(function () {
$.post('/post', {
subject: $('#fa-generated-title1').val().trim(),
t: 40,
message: $('#fa-generated-message1').val().trim(),
mode: 'reply',
tid: $('[name="tid"]:first').val(),
post: 1,
}).done(function () {
Swal.fire({
icon: 'success',
title: 'Postado com sucesso!',
allowEscapeKey: false,
showConfirmButton: false,
timerProgressBar: true
}).then((result) => {
if (
result.dismiss === Swal.DismissReason.timer
) {
location.href = 'http://' + location.host + '/t6-?view=newest';
}
});
}).fail(function () {
Swal.fire({
icon: 'error',
title: 'Erro!',
text: 'Tente novamente ou entre em contato',
});
});
}, 600);
});
});
}(jQuery));
</script>
</div>
<!-- Fim da div#form-->
</div>
</body>
</html>
Re: Erro input radio formulário
Olá @vcapelli,
Altere o seu código para:
pedxz.
Altere o seu código para:
- Código:
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="csrf-token" content="7AvAsSd2Q3ojapRq531YspINWRFvXeCd6FZwunIn">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="vcapelli" content="Policia FBR">
<link rel="icon" href="https://imgur.com/0lcWT84.png">
<title>Polícia FBR: Desligamento</title>
<link href="https://dphsystem.com.br/css/font-dphsystem.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700;900&family=Roboto:wght@300;400;500;700;900&display=swap" rel="stylesheet">
<style>
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
body {
font-size: 17px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: normal;
line-height: 1.5;
color: #212121;
line-height: 1.5;
background: #fff;
}
/**
* Begin tipografia.
*/
a,
a:active,
a:link,
a:visited,
a:focus {
color: #007bff;
text-decoration: none;
border-bottom: solid 1px transparent;
outline: 0;
}
a:hover {
border-bottom-color: #2688dc;
}
a.fa:hover {
border-bottom-color: transparent;
color: #1f6db0;
}
h3 {
font-size: 20px;
font-weight: 200;
margin-bottom: 10px;
display: block;
width: 100%;
padding-bottom: 3px;
border-bottom: 2px solid #375e7f;
}
textarea {
height: 90px;
box-sizing: border-box;
resize: vertical;
outline: none;
}
.btn {
border: solid 1px #e4e4e4;
background: linear-gradient(180deg, #fff 0%, #efefef 100%);
padding: .575rem 1.1rem;
border-radius: .175rem;
font-weight: 600;
color: #686a6b;
cursor: pointer;
display: block;
text-align: center;
margin-bottom: 5px;
width: 100%;
}
.btn:focus {
border-color: #375e7f;
box-shadow: inset 0 -5px 40px rgba(120, 120, 120, 0.1), inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(0, 0, 0, 0.1);
outline: none;
}
.btn:hover {
box-shadow: inset 0 -100px rgba(108, 108, 108, 0.1);
}
.btn.btn-primary {
border-radius: 3px;
box-shadow: none;
color: #fff;
background: #007bff;
font-size: 14px;
transition: linear all 125ms;
margin-top: 32%;
}
.btn.btn-primary:focus {
border-color: #375e7f;
box-shadow: inset 0 1px 2px rgba(39, 56, 28, 0.075), 0 0 0 0.2em rgba(39, 56, 28, 0.6);
outline: none;
}
.btn.btn-primary:hover {
background: #444;
}
.btn.btn-danger {
color: #fff;
border-color: #bd2c00;
background: #e7592e;
background: linear-gradient(180deg, #f86b40 0%, #bd2c00 100%);
}
.btn.btn-danger:focus {
border-color: #aa2c05;
box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(197, 53, 9, 0.66);
outline: none;
}
.btn-progress {
cursor: not-allowed;
opacity: .657;
}
.form-control {
background-color: #fff;
border: 1px solid #d4d4d4;
padding: 6px 8px;
margin: 5px 0 0;
display: block;
width: 100%;
font-size: 16px;
color: #555;
line-height: 20px;
border-radius: 3px;
box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075);
outline: none;
}
.form-control:focus {
border-color: #4b6b35;
box-shadow: inset 0 1px 2px rgba(75, 107, 53, 0.075), 0 0 0 0.2em rgba(75, 107, 53, 0.6);
outline: none;
}
input[type="text"]:disabled {
background: #dddddd;
cursor: not-allowed;
}
.card {
background-color: #E54732;
padding: 5px;
font-size: 10px;
color: #fff;
font-weight: 800;
border-radius: 5px;
float: left;
margin-right: 5px;
}
/*
* End tipografia.
**/
.wrapper {
width: 50%;
position: absolute;
top: 5%;
left: 50%;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
-ms-transform: translateX(-50%);
-o-transform: translateX(-50%);
transform: translateX(-50%);
}
.wrapper hgroup {
text-align: center;
}
.wrapper hgroup i.fa {
font-size: 4em;
}
.wrapper hgroup h1 {
font-weight: 300;
margin: 10px 0;
padding: 0;
color: #545454;
}
.wrapper form {
margin: 0 0 25px;
padding: 20px;
color: #555;
background-color: #fff;
}
.wrapper form .form-group label {
display: table;
}
.wrapper form .form-group .form-group-col {
float: left;
margin-right: 2%;
margin-top: 2%;
margin-bottom: 2%;
}
.form-group .form-group-col:first-child {
margin-left: 3%;
}
.wrapper footer {
border: solid 1px #d6d6d6;
border-radius: 3px;
padding: 13px;
text-align: center;
font-size: 16px;
color: #555;
margin-bottom: 2%;
}
.col-94 {
width: 94%;
}
.col-30 {
width: 30%;
}
.col-46 {
width: 46%;
}
/**
* FOR JS Styles:
*/
#fa-generated-form,
footer {
box-shadow: 3px 3px 2px 0px rgba(0, 0, 0, 0.16);
}
.title h2 {
font-weight: 300;
margin-bottom: 5px;
text-align: center;
}
.title h4 {
font-weight: 300;
margin-bottom: 15px;
text-align: center;
}
@media screen and (max-width: 850px) {
.selected, .d-none{
width: 100%!important;
}
}
body{
display: block;
}
.menu{
position: relative;
z-index: 9;
color: #fff;
top: 0;
width: 100%;
display: block;
border-bottom: 1px solid #ddd;
}
.menu .top{
text-align: center;
font-family: Industry;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
padding: 8px;
background-color: #313a46;
border-bottom: 1px solid #ddd;
box-shadow: 0px 0px 2px 0px rgba(178, 188, 196, 0.5);
z-index: 1;
}
.menu .bot{
background-color: #fff;
padding: 16px 32px;
color: #333;
}
.menu .top h1{
font-size: 1.75em;
font-family: montserrat;
font-weight: 400;
margin: 0 12px;
}
.menu .bot h2{
font-size: 17px;
font-weight: 500;
}
.menu select{
overflow-y: auto;
background: transparent;
border: 0;
border: 1px solid #444;
margin-bottom: 6px;
padding: 2px 4px;
}
.menu option{
padding: 2px 5px;
color: #333;
}
.menu p{
font-size: 14px;
font-weight: 300;
}
.wrapper{
height: auto;
width: 100%;
margin: auto;
position: relative;
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: none;
}
.selected, .d-none {
width: 75%;
margin: auto;
}
#fa-generated-form{
box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
}
.selected{
display: block;
}
.d-none{
display: none;
}
.title h4{
font-weight: 700;
font-family: poppins;
font-size: 30px;
text-transform: uppercase;
}
textarea[name*="texto"]{
height: 200px;
}
.form-check:nth-child(1) {
margin-left: 0;
}
.form-check {
align-items: center;
margin: 0 4px;
}
.form-group-check, .form-check {
display: flex;
}
.form-check-input {
margin-right: 4px;
}
select {
border: 1px solid #d4d4d4!important;
padding: 6px 8px!important;
}
.form-group-check {
min-height: 36px;
}
</style>
<script>
$(document).ready(function() {
$('#config-primary').on('click', function() {
if( $('.config-secondary').css('visibility') == 'hidden' ) $('.config-secondary').css('visibility', 'visible');
else $('.config-secondary').css('visibility', 'hidden');
});
$('#select-form').on('change', function(e) {
var optionSelected = $(this).find(':selected');
var targetID = optionSelected[0].dataset.target;
// Aplicar classe d-none para div com classe selected
$('.selected').addClass('d-none');
// Remover classe selected da div com classe selected
$('.selected').removeClass('selected');
// Remover classe d-none para div com id target
$(targetID).removeClass('d-none');
// Aplicar classe selected para div com id target
$(targetID).addClass('selected');
});
});
</script>
</head>
<body>
<div class="menu">
<div class="bot">
<p>Em caso de dificuldades acesse o formulário direto <a href="/h13-">clique aqui!</a></p>
</div>
<div class="wrapper">
<div id="form" class="selected">
<form id="fa-generated-form1">
<div class="title">
<h4>Requerimento postagem aulas</h4>
</div>
<h3>Dados da aula</h3>
<div class="form-group" style="margin-bottom: 5%;">
<div class="form-group-col col-30">
<label for="campo1">Nick do professor:</label>
<input type="text" id="campo1" class="form-control" placeholder="Ex: Barbara:-P" required/>
</div>
<div class="form-group-col col-30">
<label for="campo2">Nick do aluno:</label>
<input type="text" id="campo2" class="form-control" placeholder="Ex: sNog" required/>
</div>
<div class="form-group-col col-30">
<label>Situação:</label>
<div class="form-group-check">
<div class="form-check">
<input class="form-check-input" type="radio" name="SituacaoRadio" id="campo4" value="Aprovado" checked>
<label class="form-check-label" for="campo4">
Aprovado
</label>
<input class="form-check-input" type="radio" name="SituacaoRadio" id="campo5" value="Reprovado" >
<label class="form-check-label" for="campo5">
Reprovado
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="form-group-col col-46">
<label for="campo3">Aula:</label>
<select data-type="select" class="form-control shadow-sm" id="campo3" required="">
<option value="Aula de Formação de Soldados">Aula de Formação de Soldados (AFS)</option>
<option value="Aula Prática de Comandos">Aula Prática de Comandos (APC)</option>
<option value="Escola de Formação de Cabos">Escola de Formação de Cabos (EFCb)</option>
<option value="Treino Prático de Cabos">Treino Prático de Cabos (TpC)</option>
<option value="Escola de Sargento das Armas">Escola de Sargento das Armas (ESA)</option>
<option value="Treino Prático de Sargentos">Treino Prático de Sargentos (TpS)</option>
<option value="Exame de Aptidão de Praças">Exame de Aptidão de Praças (EAP)</option>
</select>
</div>
<div class="form-group-col col-46">
<label for="campo6">Se reprovado, print's:</label>
<input type="text" id="campo6" class="form-control" placeholder=""/>
</div>
</div>
<br/>
<button type="submit" class="btn btn-primary">Enviar</button>
</form>
<!-- Javascript's -->
<!-- Não recomendada a edição abaixo desta linha. -->
<textarea style="display: none;" id="fa-generated-message1">[center][size=18][font=sans-serif]{{campo3}}[/font][/size][/center]
[b]Nick do professor:[/b] {{campo1}}
[b]Aula:[/b] {{campo3}}
[b]Nick do aluno:[/b] {{campo2}}
[b]Situação:[/b] {{campo4}}
[b]Se reprovado, prin's:[/b] {{campo6}}</textarea>
<input type="hidden" id="fa-generated-title1" value="{{campo2}}" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
<script src="https://forumeiros.github.io/assets/src/form-generator/form-replace.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.13/dist/sweetalert2.all.min.js"></script>
<script type="text/javascript">
(function ($) {
'use strict';
$(function () {
var $textarea = $('#fa-generated-message1');
var $title = $('#fa-generated-title1');
var $form = $('#fa-generated-form1');
$form.on('submit', function (event) {
if ($textarea.length === 0) {
event.preventDefault();
alert('[Erro Código 001 | Form Functions] Tente novamente!');
return false;
}
$textarea.val($textarea.val().replace(/\{\{campo(\d+)\}\}/gi, function (text, match) {
return $('#campo' + match).val();
}));
if ($title.length === 0) {
return;
}
$title.val($title.val().replace(/\{\{campo(\d+)\}\}/gi, function (text, match) {
return $('#campo' + match).val();
}));
});
});
}(jQuery));
</script>
<script type="text/javascript">
(function ($) {
'use strict';
$(window).on('load', function () {
$('#fa-generated-form1').on('submit', function (event) {
event.preventDefault();
if ($('#campo5').is(':checked')) {
$('#campo4').val($('#campo5').val());
}
$(this).find('button[type="submit"]').text('Postando...');
setTimeout(function () {
$.post('/post', {
subject: $('#fa-generated-title1').val().trim(),
t: 40,
message: $('#fa-generated-message1').val().trim(),
mode: 'reply',
tid: $('[name="tid"]:first').val(),
post: 1,
}).done(function () {
Swal.fire({
icon: 'success',
title: 'Postado com sucesso!',
allowEscapeKey: false,
showConfirmButton: false,
timerProgressBar: true
}).then((result) => {
if (
result.dismiss === Swal.DismissReason.timer
) {
location.href = 'http://' + location.host + '/t6-?view=newest';
}
});
}).fail(function () {
Swal.fire({
icon: 'error',
title: 'Erro!',
text: 'Tente novamente ou entre em contato',
});
});
}, 600);
});
});
}(jQuery));
</script>
</div>
<!-- Fim da div#form-->
</div>
</body>
</html>
pedxz.
Fórum ilegalInformamos que o seu fórum corre o risco de ser eliminado por não estar de acordo com as Condições Gerais de Uso. Por favor, queira regularizar o seu fórum o mais rápido possível. Tenha em conta que o suporte a fóruns ilegais é limitado, para mais informações, consulte: Atendimento aos fóruns ilegais. |
tikky- Admineiro
- Membro desde : 13/01/2017
Mensagens : 7964
Pontos : 9219
Re: Erro input radio formulário
Tópico resolvidoMovido para "Questões resolvidas". |
tikky- Admineiro
- Membro desde : 13/01/2017
Mensagens : 7964
Pontos : 9219
Fórum dos Fóruns :: Ajuda e atendimento ao utilizador :: Questões sobre códigos :: Questões resolvidas sobre HTML e BBCode
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos