Hello everyone,


I have a button to add records. What I am trying to do is when I click on 
it I want to display a modal that contains a Crud form to create/add a new 
record. 

Something like this Example 
<https://editor.datatables.net/examples/simple/simple.html>

Any suggestions to do that?
This is my try


Controller

def Person():
    person= db(db.Person.id>0).select()
    return dict(formListar=person)


View

<script>
 $('#add').click(function(e) {
 e.preventDefault();
 btn = $(this);
 thisHref = btn.attr('href');
 $('#myModalAdd').modal('show')
 .one('click', '#warning', function(e) {
    window.location = thisHref;});
 });
</script>


<a class="btn btn-default" id="add" 
href="/{{=request.application}}/Tools/AddPerson"><span 
class="glyphicon glyphicon-plus"></span> Add Person</a>


<div id="myModalEdit" class="modal fade">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
       <h4 class="modal-title">Add Person</h4>
      </div>
      <div class="modal-body">
       <p>
           {{=formListar}}
       </p>
      </div>
      <div class="modal-footer">
      </div>
     </div>
    </div>
  </div>





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to