not working modal and java script and a function

Asked

Viewed 52 times

-2

I made a crud that registers and deletes and edits, only in the edit part does not work the modal also part of the code that I think the problems:

 <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="load_modal('<?php echo $value->titulo;?>', '<?php echo $value->categoria; ?>','<?php echo $value->autor; ?>','<?php echo $value->breve_resumo; ?>', '<?php echo $value->id; ?>')">
                Editar
          </button>//esse é  do botão editar ele aparece só que não ta fazendo a função de editar e nem aparecendo o modal

here is the code of the modal:

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labellebby="myModalLabel">
           <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dimissmiss="modal" aria-label="close"><span aria-hidden="true">&times</span></button>
                 <h4 class="modal-title" id="myModalLabel">Alterando Livros</h4>
               </div>
               <div class="modal-body">
                <form class="form-inline" method="POST">

                   <div class="input-group">
                     <span class="input-group-addon">titulo:</span>
                     <input id="text_titulo" name="titulo" type="text" class="form-control" required value="">
                   </div>

                   <div class="input-group">
                     <span class="input-group-addon">categoria:</span>
                     <input id="text_categoria" name="categoria" type="text" class="form-control" required value="">
                   </div>

                   <div class="input-group">
                     <span class="input-group-addon">autor:</span>
                     <input id="text_autor" name="autor" type="text" class="form-control" required value="">
                   </div>
                   <div class="input-group">
                     <span class="input-group-addon">breve resumo:</span>
                     <input id="text_breve_resumo" name="breve_resumo" type="text" class="form-control" required value="">
                   </div>

                   <input  id="id_uii" name="id_ui" type="hidden" value="<?php echo $value->id;?>"/>
                   <input  name="alterar" type="submit" class="btn btn-warning" value="Alterar">
                       </form>
                     </div>
                   </div>
                 </div>
               </div>
  • Can you elaborate a [mcve] demonstrating the problem? Take the opportunity to describe what would be the "does not work".

1 answer

1


Friend, ta missing further exemplify the problem, but giving an analyzed I see that you are using Bootstrap.

To see if everything is right in your modal, put this jquery inside a function and call it -->

$(document).ready(function(){
  $('#myModal').modal('show')
});

if this does not work, it is good to know if other bootstrap components are running, to rule out the possibility of error in importing the Tyles.

  • in modal-action you have to put that in it?

  • friend I put the code not opened the modal just trimmed a link written the "will open the modal" top on the page

  • put and now ?

  • is not Materialize friend..... puts this Jquery inside a function and calls - a... $(Document). ready(Function(){ $('#myModal'). modal('show') });

  • type I put only that it appears the link ecrito 'will open modal' so that when clikco in the 'will open modal' appears in the URL #myModal

  • SEND THE ENTIRE PAGE IN MY EMAIL, I SEE FOR YOU. [email protected].

  • friend I got wheel the modal, is that I had written a wrong part in script k

  • kkkk, good friend, this is part of the routine

  • now I have another problem, open the modal to edit so that when I click the edit button of this following error : Fatal error: Uncaught Pdoexception: SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'title' cannot be null in /home/lgobira/projects/Painellivro_clig/classes/book2.php:49 Stack trace: #0 /home/lgobira/projects/Painellivro_clig/classes/book2.php(49): Pdostatement->execute() #1 /home/lgobira/projects/Painellivro_clig/index.php(100): Bookbook2->update('352') #2 {main} thrown in /home/lgobira/projects/Painellivro_clig/classes/book2.php on line 49

  • It seems to me that you are sending a null value to the title column, apparently there is no null restriction in the bank.... tip... spread console log by your code

  • Friend, remove the status of [Pending], and if you want to give a positive vote on my reply. Xp

  • ta td bem kk, but help me here with this problem this problem in the bank I do not understand much I am starting now in the world of codes

  • how to shoot the status of [pending] ?

Show 8 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.