Formulário não substitui a variável pelo texto

3 participantes

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Tópico resolvido Formulário não substitui a variável pelo texto

Mensagem por vcapelli 09.03.21 23:48

Detalhes da questão


Endereço do fórum: http://sistema-forum.forumeiros.com
Versão do fórum: ModernBB

Descrição


Meu formulário não posta o que eu coloco nos input, posta como na imagem abaixo Ajuda/Confuso

Formulário não substitui a variável pelo texto GZRhR5y

Código formulário
Código:
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"/>
  <title>Capelli</title>
  <meta charset="utf-8">
  <style type="text/css">
    *,
    *::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: 300;
      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 {
      border: solid 1px #d4d4d4;
      margin: 0 0 25px;
      padding: 20px;
      color: #555;
      border-radius: 4px;
      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: 900px) {
      .wrapper {
        width: 40%;
      }
    }
 
    @media screen and (max-width: 600px) {
      .wrapper {
        width: 70%;
      }
    }
 
    @media screen and (max-width: 500px) {
      .wrapper {
        width: 80%;
      }
    }
 
    @media screen and (max-width: 400px) {
      .wrapper {
        width: 90%;
      }
    }
  </style>
</head>
<body>
  <main class="wrapper">
 
    <div id="form-rebaixamento" class="d-none">
                <form id="fa-generated-form2">
                    <div class="title">
                      <h4>Requerimento Rebaixamento</h4>
                    </div>
                    <h3>Dados do punidor</h3>
                    <div class="form-group" style="margin-bottom: 5%;">
                      <div class="form-group-col col-30">
                        <label for="campo10">Patente:</label>
                        <input type="text" id="campo10" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo11">Nickname:</label>
                        <input type="text" id="campo11" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo12">TAG:</label>
                        <input type="text" id="campo12" class="form-control" placeholder="" required/>
                      </div>
                    </div>
                    <h3>Dados do rebaixado</h3>
                    <div class="form-group">
                      <div class="form-group-col col-30">
                        <label for="campo13">Antiga patente:</label>
                        <input type="text" id="campo13" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo14">Nickname:</label>
                        <input type="text" id="campo14" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo15">Nova patente:</label>
                        <input type="text" id="campo15" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-94">
                        <label for="campo16">Motivos do Rebaixamento:</label>
                        <textarea data-type="textarea" id="campo16" class="form-control" placeholder="" required=""></textarea>
                      </div>
                      <div class="form-group-col col-46">
                        <label for="campo17">Data:</label>
                        <input type="text" id="campo17" class="form-control" disabled/>
                      </div>
                      <div class="form-group-col col-46">
                        <label for="campo18">Permissão:</label>
                        <input type="text" id="campo8" class="form-control" placeholder="" required/>
                      </div>
                    </div>
                    <div class="form-group">
                      <div class="form-group-col col-94">
                        Ao rebaixar um policial você está ciente das normas de promoção.
                      </div>
                    </div>
                    <br/>
                    <button type="submit" class="btn btn-primary">Enviar</button>
             
                  </form>
                  <!-- Javascript's -->
  <!-- Não recomendada a edição abaixo desta linha. -->
   
  <script>
    var instance = new Date();
 
    var month =["Jan","Fev","Mar", "Abr","Mai","Jun", "Jul","Ago","Set", "Out","Nov","Dez"];
   
    var day = (!! instance.getDate().toString()[1]) ? instance.getDate() : '0' + instance.getDate();
    var month_index = instance.getMonth();
    var year = instance.getFullYear();
   
    var date = [ day, month[month_index], year ].join(" ");
   
    document.getElementById('campo17').value = date;
  </script>
 
  <textarea style="display: none;" id="fa-generated-message2">[center][size=18][font=sans-serif]PROMOÇÃO[/font][/size][/center]
 
[b]Sua patente:[/b] {{campo10}}
[b]Seu nick:[/b] {{campo11}}

[b]Rebaixamento:[/b] {{campo11}} à {{campo15}}
 
[b]{{campo14}} [R/{{campo12}}] {{campo17}}[/b]

[b]Motivos para o rebaixamento:[/b] {{campo16}}
[b]Permissão:[/b] {{campo18}}</textarea>
  <input type="hidden" id="fa-generated-title2" value="{{campo14}}" />
 
  <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';
 
    $(window).on('load', function () {
    $('#fa-generated-form2').on('submit', function (event) {
        event.preventDefault();
        $(this).find('button[type="submit"]').text('Postando...');
        setTimeout(function () {
      $.post('/post', {
      subject: $('#fa-generated-title2').val().trim(),
      t: 1,
      message: $('#fa-generated-message2').val().trim(),
      mode: 'reply',
      tid: $('[name="tid"]:first').val(),
      post: 1,
      }).done(function () {
      Swal.fire({
          icon: 'success',
          title: 'Postado com sucesso!',
          html: 'Você será redicionado ao fórum',
          timer: 3000,
          allowEscapeKey: false,
          showConfirmButton: false,
          timerProgressBar: true
    }).then((result) => {
          if (
              result.dismiss === Swal.DismissReason.timer
              ) {
        location.href = 'http://' + location.host + '/t1-?view=newest';
        }
    });
      }).fail(function () {
      alert('Houve um erro! Tente novamente!');
      });
        }, 600);
    });
    });
    }(jQuery));
  </script>
</body>
</html>
vcapelli

vcapelli
****

Membro desde : 17/02/2018
Mensagens : 210
Pontos : 417

https://sistema-forum.forumeiros.com/ https://www.facebook.com/capellindao https://twitter.com/vitorcapee

Ir para o topo Ir para baixo

  • 0

Tópico resolvido Re: Formulário não substitui a variável pelo texto

Mensagem por Musashi 10.03.21 9:52

Olá  @vcapelli

Ele somente postava assim, por conta que não tinha um texto predeterminado de o que exatamente ele iria postar, tente o seguinte HTML:

Código:
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"/>
  <title>Capelli</title>
  <meta charset="utf-8">
  <style type="text/css">
    *,
    *::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: 300;
      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 {
      border: solid 1px #d4d4d4;
      margin: 0 0 25px;
      padding: 20px;
      color: #555;
      border-radius: 4px;
      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: 900px) {
      .wrapper {
        width: 40%;
      }
    }
 
    @media screen and (max-width: 600px) {
      .wrapper {
        width: 70%;
      }
    }
 
    @media screen and (max-width: 500px) {
      .wrapper {
        width: 80%;
      }
    }
 
    @media screen and (max-width: 400px) {
      .wrapper {
        width: 90%;
      }
    }
  </style>
</head>
<body>
  <main class="wrapper">
 
    <div id="form-rebaixamento" class="d-none">
                <form id="fa-generated-form2">
                    <div class="title">
                      <h4>Requerimento Rebaixamento</h4>
                    </div>
                    <h3>Dados do punidor</h3>
                    <div class="form-group" style="margin-bottom: 5%;">
                      <div class="form-group-col col-30">
                        <label for="campo10">Patente:</label>
                        <input type="text" id="campo10" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo11">Nickname:</label>
                        <input type="text" id="campo11" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo12">TAG:</label>
                        <input type="text" id="campo12" class="form-control" placeholder="Digte a TAG sem '[]' " required/>
                      </div>
                    </div>
                    <h3>Dados do rebaixado</h3>
                    <div class="form-group">
                      <div class="form-group-col col-30">
                        <label for="campo13">Antiga patente:</label>
                        <input type="text" id="campo13" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo14">Nickname:</label>
                        <input type="text" id="campo14" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-30">
                        <label for="campo15">Nova patente:</label>
                        <input type="text" id="campo15" class="form-control" placeholder="" required/>
                      </div>
                      <div class="form-group-col col-94">
                        <label for="campo16">Motivos do Rebaixamento:</label>
                        <textarea data-type="textarea" id="campo16" class="form-control" placeholder="" required=""></textarea>
                      </div>
                      <div class="form-group-col col-46">
                        <label for="campo17">Data:</label>
                        <input type="text" id="campo17" class="form-control" disabled/>
                      </div>
                      <div class="form-group-col col-46">
                        <label for="campo18">Permissão:</label>
                        <input type="text" id="campo18" class="form-control" placeholder="" required/>
                      </div>
                    </div>
                    <div class="form-group">
                      <div class="form-group-col col-94">
                        Ao rebaixar um policial você está ciente das normas de promoção.
                      </div>
                    </div>
                    <br/>
                    <button type="submit" class="btn btn-primary">Enviar</button>
           
                  </form>
                  <!-- Javascript's -->
  <!-- Não recomendada a edição abaixo desta linha. -->
 
  <script>
    var instance = new Date();
 
    var month =["Jan","Fev","Mar", "Abr","Mai","Jun", "Jul","Ago","Set", "Out","Nov","Dez"];
 
    var day = (!! instance.getDate().toString()[1]) ? instance.getDate() : '0' + instance.getDate();
    var month_index = instance.getMonth();
    var year = instance.getFullYear();
 
    var date = [ day, month[month_index], year ].join(" ");
 
    document.getElementById('campo17').value = date;
  </script>
 
  <textarea style="display: none;" id="fa-generated-message2">[center][size=18][font=sans-serif]PROMOÇÃO[/font][/size][/center]
 
[b]Seu cargo e nickname:[/b] {{campo10}} {{campo11}}
[b]Sua TAG: [{{campo12}}][/b]
 
[b]Nickname do rebaixado: {{campo14}}[/b]
[b]Rebaixamento:[/b] {{campo11}} à {{campo15}}
 
[b]{{campo14}} [R/{{campo12}}] {{campo17}}[/b]

[b]Permissão: {{campo18}}[/b]
 
  <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 () {
        $('@form-content').on(submit, function (event) {

            var data = {
                campo8: $('#campo8'). val(),
                campo10: $('#campo10'). val(),
                campo11: $('#campo11'). val(),
                campo12: $('#campo12'). val(),
                campo13: $('#campo13'). val(),
                campo14: $('#campo14'). val(),
                campo15: $('#campo15'). val(),
                campo16: $('#campo16'). val(),
                campo17: $('#campo17'). val(),
                campo18: '',
            }
            if ($('#campo18').val()=== '') {
                data.campo18 = 'N/A';
            } else {
                data.campo18 = $('#campo18').val();
            }

            event.preventDefault();
            setTimeout(function () {
                  $.post('/post', {
                      t: 1,
                      message: [
              '[center][b][color=#ff0000]Modelo I - Promoção[/color][/b][/center]',
              '',
                      '[b]Seu posto e nickname:[/b] ' + data.campo10 + ' ' + data.campo11,
                      '[b]Sua TAG:[/b] ' + data.campo12,
                      '',
                      '[b]Nickname do rebaixado:[/b]' + data.campo14,
                      '[b]' + data.npromovido + ' [' + data.tag + '] ' + data.datapromo + '[/b]',
                      '',
                      '[b]Motivos para a promoção:[/b] ' + data.campo16,
                      '[b]Permissão:[/b] ' + data.campo18,
                      '',
                      ].join('\n'),
                      mode: 'reply',
                      tid: $('[name="tid"]:first').val(),
                      post: 1,
                      attach_sig: 'on'
                  }).done(function () {
                      alert('Postado com sucesso. Você será redirecionado para o tópico...');
                location.href = '/t1-' + location.host + '/t1-?view=newest';
                  }).fail(function () {
                      alert('Houve um erro! Tente novamente!');
                  });
            }, 600);
          });
      });
    }(jQuery));
  </script>
  </body>
  </html>
 

Atenciosamente, Wusthy Muito feliz
Musashi

Musashi
Membro

Membro desde : 17/02/2021
Mensagens : 588
Pontos : 762

https://luciothemes.forumeiros.com/

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Formulário não substitui a variável pelo texto

Mensagem por tikky 10.03.21 15:29

Olá  @vcapelli,

Altere a sua página para:
Código:
<!DOCTYPE html>
        <html>
        <head>
          <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"/>
          <title>Capelli</title>
          <meta charset="utf-8">
          <style type="text/css">
            *,
            *::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: 300;
              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 {
              border: solid 1px #d4d4d4;
              margin: 0 0 25px;
              padding: 20px;
              color: #555;
              border-radius: 4px;
              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: 900px) {
              .wrapper {
                width: 40%;
              }
            }
        
            @media screen and (max-width: 600px) {
              .wrapper {
                width: 70%;
              }
            }
        
            @media screen and (max-width: 500px) {
              .wrapper {
                width: 80%;
              }
            }
        
            @media screen and (max-width: 400px) {
              .wrapper {
                width: 90%;
              }
            }
          </style>
        </head>
        <body>
          <main class="wrapper">
        
            <div id="form-rebaixamento" class="d-none">
                        <form id="fa-generated-form">
                            <div class="title">
                              <h4>Requerimento Rebaixamento</h4>
                            </div>
                            <h3>Dados do punidor</h3>
                            <div class="form-group" style="margin-bottom: 5%;">
                              <div class="form-group-col col-30">
                                <label for="campo10">Patente:</label>
                                <input type="text" id="campo10" class="form-control" placeholder="" required/>
                              </div>
                              <div class="form-group-col col-30">
                                <label for="campo11">Nickname:</label>
                                <input type="text" id="campo11" class="form-control" placeholder="" required/>
                              </div>
                              <div class="form-group-col col-30">
                                <label for="campo12">TAG:</label>
                                <input type="text" id="campo12" class="form-control" placeholder="" required/>
                              </div>
                            </div>
                            <h3>Dados do rebaixado</h3>
                            <div class="form-group">
                              <div class="form-group-col col-30">
                                <label for="campo13">Antiga patente:</label>
                                <input type="text" id="campo13" class="form-control" placeholder="" required/>
                              </div>
                              <div class="form-group-col col-30">
                                <label for="campo14">Nickname:</label>
                                <input type="text" id="campo14" class="form-control" placeholder="" required/>
                              </div>
                              <div class="form-group-col col-30">
                                <label for="campo15">Nova patente:</label>
                                <input type="text" id="campo15" class="form-control" placeholder="" required/>
                              </div>
                              <div class="form-group-col col-94">
                                <label for="campo16">Motivos do Rebaixamento:</label>
                                <textarea data-type="textarea" id="campo16" class="form-control" placeholder="" required=""></textarea>
                              </div>
                              <div class="form-group-col col-46">
                                <label for="campo17">Data:</label>
                                <input type="text" id="campo17" class="form-control" disabled/>
                              </div>
                              <div class="form-group-col col-46">
                                <label for="campo18">Permissão:</label>
                                <input type="text" id="campo8" class="form-control" placeholder="" required/>
                              </div>
                            </div>
                            <div class="form-group">
                              <div class="form-group-col col-94">
                                Ao rebaixar um policial você está ciente das normas de promoção.
                              </div>
                            </div>
                            <br/>
                            <button type="submit" class="btn btn-primary">Enviar</button>
                    
                          </form>
                          <!-- Javascript's -->
          <!-- Não recomendada a edição abaixo desta linha. -->
          
          <script>
            var instance = new Date();
        
            var month =["Jan","Fev","Mar", "Abr","Mai","Jun", "Jul","Ago","Set", "Out","Nov","Dez"];
          
            var day = (!! instance.getDate().toString()[1]) ? instance.getDate() : '0' + instance.getDate();
            var month_index = instance.getMonth();
            var year = instance.getFullYear();
          
            var date = [ day, month[month_index], year ].join(" ");
          
            document.getElementById('campo17').value = date;
          </script>
        
          <textarea style="display: none;" id="fa-generated-message">[center][size=18][font=sans-serif]PROMOÇÃO[/font][/size][/center]
        
        [b]Sua patente:[/b] {{campo10}}
        [b]Seu nick:[/b] {{campo11}}
        
        [b]Rebaixamento:[/b] {{campo11}} à {{campo15}}
        
        [b]{{campo14}} [R/{{campo12}}] {{campo17}}[/b]
        
        [b]Motivos para o rebaixamento:[/b] {{campo16}}
        [b]Permissão:[/b] {{campo18}}</textarea>
          <input type="hidden" id="fa-generated-title" value="{{campo14}}" />
        
          <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';
        
            $(window).on('load', function () {
            $('#fa-generated-form').on('submit', function (event) {
                event.preventDefault();
                $(this).find('button[type="submit"]').text('Postando...');
                setTimeout(function () {
              $.post('/post', {
              subject: $('#fa-generated-title').val().trim(),
              t: 1,
              message: $('#fa-generated-message').val().trim(),
              mode: 'reply',
              tid: $('[name="tid"]:first').val(),
              post: 1,
              }).done(function () {
              Swal.fire({
                  icon: 'success',
                  title: 'Postado com sucesso!',
                  html: 'Você será redicionado ao fórum',
                  timer: 3000,
                  allowEscapeKey: false,
                  showConfirmButton: false,
                  timerProgressBar: true
            }).then((result) => {
                  if (
                      result.dismiss === Swal.DismissReason.timer
                      ) {
                location.href = 'http://' + location.host + '/t1-?view=newest';
                }
            });
              }).fail(function () {
              alert('Houve um erro! Tente novamente!');
              });
                }, 600);
            });
            });
            }(jQuery));
          </script>
        </body>
        </html>
Esse erro acontece porque o senhor renomeou alguns ID de elementos que são usados como referência para substituir a variável do campo para o texto escrito pelo membro, como, por exemplo o fa-generated-form2, basta tirar o 2 ficando fa-generated-form

Atenciosamente,
pedxz.
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7822
Pontos : 9063

Ir para o topo Ir para baixo

Tópico resolvido Re: Formulário não substitui a variável pelo texto

Mensagem por vcapelli 10.03.21 19:56

Obrigado amigos! Party
vcapelli

vcapelli
****

Membro desde : 17/02/2018
Mensagens : 210
Pontos : 417

https://sistema-forum.forumeiros.com/ https://www.facebook.com/capellindao https://twitter.com/vitorcapee

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Formulário não substitui a variável pelo texto

Mensagem por tikky 10.03.21 20:10

Tópico resolvido


Movido para "Questões resolvidas".
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7822
Pontos : 9063

Ir para o topo Ir para baixo

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

- Tópicos semelhantes

Permissões neste sub-fórum
Não podes responder a tópicos