Jump to content

Recommended Posts

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 have

destino 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?
Link to comment
https://forums.phpfreaks.com/topic/301278-serialize-form-values/
Share on other sites

<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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.