add name edition in profile
[platal.git] / htdocs / javascript / profile.js
index bbffc58..67bf48a 100644 (file)
@@ -88,7 +88,26 @@ function selectType(selectCtrl, type)
     }
 }
 
+function addSearchName()
+{
+  var i = 0;
+  while (document.getElementById('search_name_' + i) != null) {
+      i++;
+  }
+  $('#add_search_name').before('<div id="search_name_' + i + '" style="padding:2px" class="center"></div>');
+  Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i,function(){
+    $('#search_name_'+i+' input')[1].focus();
+  });
+}
 
+function removeSearchName(i)
+{
+  if (document.getElementById('search_name_'+i+'_new') != null) {
+    $('#search_name_'+i).remove();
+  } else {
+    removeObject('search_name_'+i, 'search_name['+i+']');
+  }
+}
 
 // Addresses
 
@@ -187,6 +206,7 @@ function validGeoloc(id, pref)
     document.getElementById(id + '_geoloc_valid').style.display = 'none';
     document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
     document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
+    document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value;
     attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
                 function() { document.forms.prof_annu[pref + "[text]"].blur(); });
     document.forms.prof_annu[pref + "[text]"].className = '';
@@ -197,7 +217,7 @@ function validAddress(id, pref)
     document.getElementById(id + '_geoloc').style.display = 'none';
     document.getElementById(id + '_geoloc_error').style.display = 'none';
     document.getElementById(id + '_geoloc_valid').style.display = 'none';
-    document.forms.prof_annu[pref + "[parsevalid]"].value = "0";
+    document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
     attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
                 function() { document.forms.prof_annu[pref + "[text]"].blur(); });
     document.forms.prof_annu[pref + "[text]"].className = '';