Hello everybody,

I have a Datatable filled with registers from a database and for each row I 
have a 'delete' button, what I'm trying to do is display a modal 
(bootstrap) delete confirmation (yes/no) but I don't know how to pass the 
id of that particular register so I can delete from the database.

this is the database 
db.define_table('Carrera',
                Field('descripcion','string', label='Descripción', requires 
= IS_NOT_EMPTY(error_message="Introduzca una descripción")),
                Field('titulo', 'string', label='Título', requires = 
IS_NOT_EMPTY(error_message="Introduzca el nombre del título")),
                Field('duracion', 'integer', label='Duración', requires = 
IS_NOT_EMPTY(error_message="Introduzca la duración (años) de la carrera")),
                Field('unidadAcademica','reference UnidadAcademica', 
label='Unidad académica', requires = 
IS_IN_DB(db,db.UnidadAcademica.id,'%(descripcion)s', 
error_message="Seleccione una unidad académica") ),
                Field('niveltitulacion','reference NivelTitulacion', 
label='Nivel titulación', requires = 
IS_IN_DB(db,db.NivelTitulacion.id,'%(descripcion)s', 
error_message="Seleccione un nivel de titulación") ),
                format= ' %(descripcion)s'
               )

this is the modal
div id="myModal" class="modal fade">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
       <h4 class="modal-title">Confirmación <span class="glyphicon 
glyphicon-warning-sign"></span></h4>
      </div>
      <div class="modal-body">
       <p>
           Si desea eliminar este registro, confirme su elección 
seleccionando 'Eliminar'
           o seleccione 'Cancelar' para regresar a la pagina de trabajo.
          </p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" 
data-dismiss="modal">Cancel</button>
        <button type="button" id="warning" class="btn btn-warning" 
onclick=myFunctiondelete()>Delete<span class="glyphicon 
glyphicon-remove"></span></button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

this is the script that displays the modal
function myFunction() {
    $('#myModal').modal('show');
    return false;
};

What I need is to get the id of the register that I want to delete.

I hope someone can help me

Thanks :)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to