From 32bec85c3a3744fc9110c2869ac58f01292540c8 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 14 Jan 2014 00:33:19 +0100 Subject: [PATCH] Manage submit event in modal forms --- inc/myco.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inc/myco.js b/inc/myco.js index de74c53..60f1f3a 100644 --- a/inc/myco.js +++ b/inc/myco.js @@ -32,7 +32,8 @@ on_show_add_group_modal=function(e) { $('#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; if (name=='') { alert('Vous devez saisir un nom !'); @@ -189,7 +190,8 @@ on_show_add_contributor_modal=function(e) { $('#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 name=$('#add_contributor_name')[0].value; edit_id=$('#view-group #edit_id')[0].value; @@ -436,6 +438,7 @@ on_close_login_modal=function(e) { sync_server=false; on_valid_login_modal=function(e) { + e.preventDefault(); email=$('#login_modal #login_email')[0].value; pass=$('#login_modal #login_pass')[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_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 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); @@ -600,7 +603,7 @@ $( document ).ready( function() { $('#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('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); $('#del_contributor_btn').bind('click',on_click_del_contributor_btn);