Manage submit event in modal forms
Benjamin Renard

Benjamin Renard commited on 2014-01-13 23:33:19
Showing 1 changed files, with 7 additions and 4 deletions.

... ...
@@ -32,7 +32,8 @@ on_show_add_group_modal=function(e) {
32 32
   $('#add_group_modal #add_group_name').focus();
33 33
 }
34 34
 
35
-on_valid_add_group_modal=function () {
35
+on_valid_add_group_modal=function (e) {
36
+  e.preventDefault();
36 37
   var name=$('#add_group_name')[0].value;
37 38
   if (name=='') {
38 39
     alert('Vous devez saisir un nom !');
... ...
@@ -189,7 +190,8 @@ on_show_add_contributor_modal=function(e) {
189 190
   $('#add_contributor_modal #add_contributor_name').focus();
190 191
 }
191 192
 
192
-on_valid_add_contributor_modal=function() {
193
+on_valid_add_contributor_modal=function(e) {
194
+  e.preventDefault();
193 195
   var group=groups[$('#add_contributor_modal #group_name')[0].value];
194 196
   var name=$('#add_contributor_name')[0].value;
195 197
   edit_id=$('#view-group #edit_id')[0].value;
... ...
@@ -436,6 +438,7 @@ on_close_login_modal=function(e) {
436 438
 
437 439
 sync_server=false;
438 440
 on_valid_login_modal=function(e) {
441
+  e.preventDefault();
439 442
   email=$('#login_modal #login_email')[0].value;
440 443
   pass=$('#login_modal #login_pass')[0].value;
441 444
   server=$('#login_modal #login_server')[0].value;
... ...
@@ -586,7 +589,7 @@ $( document ).ready( function() {
586 589
   $('#add_group_submit').bind('click',on_valid_add_group_modal);
587 590
   $("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal);
588 591
   $("#add_group_modal").on('hidden.bs.modal',on_close_add_group_modal);
589
-  $("#add_group_modal form").on('submit',on_valid_add_group_modal);
592
+  $("#add_group_modal form").bind('submit',on_valid_add_group_modal);
590 593
 
591 594
   $('#clear_local_data').bind('click',clear_local_data);
592 595
 
... ...
@@ -600,7 +603,7 @@ $( document ).ready( function() {
600 603
   $('#add_contributor_submit').bind('click',on_valid_add_contributor_modal);
601 604
   $("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal);
602 605
   $("#add_contributor_modal").on('hidden.bs.modal',on_close_add_contributor_modal);
603
-  $("#add_contributor_modal form").on('submit',on_valid_add_contributor_modal);
606
+  $("#add_contributor_modal form").bind('submit',on_valid_add_contributor_modal);
604 607
 
605 608
   $('#edit_contributor_btn').bind('click',on_edit_contributor_btn_click);
606 609
   $('#del_contributor_btn').bind('click',on_click_del_contributor_btn);
607 610