gmc1103 Posted May 30, 2016 Share Posted May 30, 2016 Hi I have a problem regarding the serialized form This is the problem, when i press submit the values are correct in the main file destino Funchal nivel[] 1º ciclo nivel[] 2º ciclo nivel[] 3º ciclo dinamizadores sSasA data 2016-05-25 realizado Sim motivo ASasAS colaboradores adequacao 1 participacao 2 consecucao 3 disponibilidade 4 pontos SDASDASD aspetos DSADASDSA id_visita 1 avaliacaoVisita avaliacaoVisita But in the second file the form received is this one form destino=Madeira nivel[] 2º ciclo nivel[] Secundário dinamizadores dsasdasd data 2016-05-22 realizado Sim motivo colaboradores adequacao 1 participacao 2 consecucao 3 disponibilidade 4 pontos sdadsasd aspetos sdasdadsa id_visita 2 avaliacaoVisita avaliacaoVisita And i'm trying to get the variables to fill my pdf and the first value is wrong because i havedestino Funchal and the return is form destino=Madeira To send i use function criaAvaliacaoPdfVisita() { var myform = $('#avaliacaoVisita'); var formulario = myform.serialize(); window.open("http://xxxxxxxxx/xxxxx/pdf/pdfVisitas.php?form=" + formulario, "_blank"); } Any help? Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/ Share on other sites More sharing options...
ginerjm Posted May 30, 2016 Share Posted May 30, 2016 Where is the data coming from? A form? Show us some of the html that created it. Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533324 Share on other sites More sharing options...
gmc1103 Posted May 30, 2016 Author Share Posted May 30, 2016 <div class="modal fade bs-example-modal-lg" id="myModalAvaliacaoVisita" role="dialog" aria-labelledby="confirmDeleteLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header modal-header-danger"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3><i class="glyphicon glyphicon-trash"></i> Avaliação da Visita</h3> </div> <div class="modal-body"> <form id="avaliacaoVisita" class="form"> <div class="form-group"> <label class="col-xs-12">Destino</label> <input class="form-control" name="destino" id="destino"> </div> <div class="form-group nivel"> <label class="col-xs-8">Nível de ensino em que se integra a visita (pode selecionar várias opções) *</label> <div class="col-xs-4"> <div class="checkbox"> <input type="checkbox" name="nivel[]" value="1º ciclo" id="nivel"/> <label for="nivel">1º ciclo</label> </div> <div class="checkbox"> <input type="checkbox" name="nivel[]" value="2º ciclo" id="nivel" /> <label for="nivel">2º ciclo</label> </div> <div class="checkbox"> <input type="checkbox" name="nivel[]" value="3º ciclo" id="nivel" /> <label for="nivel">3º ciclo</label> </div> <div class="checkbox"> <input type="checkbox" name="nivel[]" value="Secundário" id="nivel" /> <label for="nivel">Secundário</label> </div> <div class="checkbox"> <input type="checkbox" name="nivel[]" value="Cursos Profissionais" id="nivel" class="styled" /> <label for="nivel">Cursos Profissionais</label> </div> </div> </div> <div class="form-group"> <label class="col-xs-12 control-label"> Dinamizadores da Visita de Estudo</label> <input type="text" class="form-control" name="dinamizadores" id="dinamizadores" /> </div> <div class="form-group"> <label for="recipient-name" class="col-xs-12">Data:</label> <input class="form-control" name="data" id="data"> </div> <div class="form-group"> <label class="col-xs-4">A Visita de Estudo foi realizada na data prevista?</label> <div class="col-xs-8"> <div class="radio-inline"> <input type="radio" name="realizado" value="Sim" id="realizado" /> <label for="sim">Sim</label> </div> <div class="radio-inline"> <input type="radio" name="realizado" value="Realizou-se numa data diferente" id="realizado" class="styled" /> <label for="outradata">Realizou-se numa data diferente</label> </div> <div class="radio-inline"> <input type="radio" name="realizado" value="Não se realizou" id="realizado" class="styled" /> <label for="nao">Não se realizou</label> </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-danger">Atualizar</button> <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button> </div> </form> </div> </div> </div> </div> Thsi is my form Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533325 Share on other sites More sharing options...
Barand Posted May 30, 2016 Share Posted May 30, 2016 You don't want the "form=" after the "?". Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533327 Share on other sites More sharing options...
gmc1103 Posted May 30, 2016 Author Share Posted May 30, 2016 Yes i want...but then i have this form destino=Madeira instead of destino = Madeira Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533328 Share on other sites More sharing options...
gizmola Posted May 30, 2016 Share Posted May 30, 2016 Well I'm not sure what you are expecting. You have a destino input element in the form but it is given no value. <div class="form-group"> <label class="col-xs-12">Destino</label> <input class="form-control" name="destino" id="destino"> </div> If whatever code actually set a value for that element, then I suspect that things would work. If there is some jquery that is being used to set that dynamically, you haven't provided it. Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533329 Share on other sites More sharing options...
ginerjm Posted May 30, 2016 Share Posted May 30, 2016 I have never seen so many div tags used before. What a mess! Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533331 Share on other sites More sharing options...
gmc1103 Posted May 30, 2016 Author Share Posted May 30, 2016 Is not a mess...is the way they should be open and close div tag, for each input Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533332 Share on other sites More sharing options...
benanamen Posted May 30, 2016 Share Posted May 30, 2016 He is using bootstrap. The divs are correct. Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533335 Share on other sites More sharing options...
ginerjm Posted May 31, 2016 Share Posted May 31, 2016 Bootstrap requires an absolute excess of html tags? Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533336 Share on other sites More sharing options...
Jacques1 Posted May 31, 2016 Share Posted May 31, 2016 Yes. It's not required to use meaningless div tags, though. You can and should still write semantic markup with sensible elements. Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533339 Share on other sites More sharing options...
gmc1103 Posted June 2, 2016 Author Share Posted June 2, 2016 The tags are correct. I ahve resolved the problem using str_replace Thanks alll Quote Link to comment https://forums.phpfreaks.com/topic/301278-serialize-form-values/#findComment-1533376 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.