Manage submit event in modal forms

This commit is contained in:
Benjamin Renard 2014-01-14 00:33:19 +01:00
parent 4baf634bdb
commit 32bec85c3a

View file

@ -32,7 +32,8 @@ on_show_add_group_modal=function(e) {
$('#add_group_modal #add_group_name').focus(); $('#add_group_modal #add_group_name').focus();
} }
on_valid_add_group_modal=function () { on_valid_add_group_modal=function (e) {
e.preventDefault();
var name=$('#add_group_name')[0].value; var name=$('#add_group_name')[0].value;
if (name=='') { if (name=='') {
alert('Vous devez saisir un nom !'); alert('Vous devez saisir un nom !');
@ -189,7 +190,8 @@ on_show_add_contributor_modal=function(e) {
$('#add_contributor_modal #add_contributor_name').focus(); $('#add_contributor_modal #add_contributor_name').focus();
} }
on_valid_add_contributor_modal=function() { on_valid_add_contributor_modal=function(e) {
e.preventDefault();
var group=groups[$('#add_contributor_modal #group_name')[0].value]; var group=groups[$('#add_contributor_modal #group_name')[0].value];
var name=$('#add_contributor_name')[0].value; var name=$('#add_contributor_name')[0].value;
edit_id=$('#view-group #edit_id')[0].value; edit_id=$('#view-group #edit_id')[0].value;
@ -436,6 +438,7 @@ on_close_login_modal=function(e) {
sync_server=false; sync_server=false;
on_valid_login_modal=function(e) { on_valid_login_modal=function(e) {
e.preventDefault();
email=$('#login_modal #login_email')[0].value; email=$('#login_modal #login_email')[0].value;
pass=$('#login_modal #login_pass')[0].value; pass=$('#login_modal #login_pass')[0].value;
server=$('#login_modal #login_server')[0].value; server=$('#login_modal #login_server')[0].value;
@ -586,7 +589,7 @@ $( document ).ready( function() {
$('#add_group_submit').bind('click',on_valid_add_group_modal); $('#add_group_submit').bind('click',on_valid_add_group_modal);
$("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal); $("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal);
$("#add_group_modal").on('hidden.bs.modal',on_close_add_group_modal); $("#add_group_modal").on('hidden.bs.modal',on_close_add_group_modal);
$("#add_group_modal form").on('submit',on_valid_add_group_modal); $("#add_group_modal form").bind('submit',on_valid_add_group_modal);
$('#clear_local_data').bind('click',clear_local_data); $('#clear_local_data').bind('click',clear_local_data);
@ -600,7 +603,7 @@ $( document ).ready( function() {
$('#add_contributor_submit').bind('click',on_valid_add_contributor_modal); $('#add_contributor_submit').bind('click',on_valid_add_contributor_modal);
$("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal); $("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal);
$("#add_contributor_modal").on('hidden.bs.modal',on_close_add_contributor_modal); $("#add_contributor_modal").on('hidden.bs.modal',on_close_add_contributor_modal);
$("#add_contributor_modal form").on('submit',on_valid_add_contributor_modal); $("#add_contributor_modal form").bind('submit',on_valid_add_contributor_modal);
$('#edit_contributor_btn').bind('click',on_edit_contributor_btn_click); $('#edit_contributor_btn').bind('click',on_edit_contributor_btn_click);
$('#del_contributor_btn').bind('click',on_click_del_contributor_btn); $('#del_contributor_btn').bind('click',on_click_del_contributor_btn);