Reset errors when loading values
authorJoey Schulze <joey@infodrom.org>
Thu, 5 May 2011 16:52:00 +0000 (18:52 +0200)
committerJoey Schulze <joey@infodrom.org>
Thu, 5 May 2011 16:52:00 +0000 (18:52 +0200)
lib/functions.js

index d49f91c..6ff9c08 100644 (file)
@@ -213,6 +213,14 @@ function form_elem_ok(elem)
     elem.style.borderStyle = '';
 }
 
+function form_reset_errors()
+{
+   for (name in form_check) {
+       var elem = document.getElementById('edit_' + name);
+       form_elem_ok(elem);
+    }
+}
+
 var form_check_regexp = {
     number: /^\d+$/,
     decimal: /^\d*([,\.]\d+)?$/,
@@ -408,6 +416,7 @@ function gridDrillDown(e)
     if (document.getElementById('form_edit')) {
        var params = 'source=' + grid.tableId.substr(5) + '&id=' + value;
        ajax_request('fetch', params, fetch_callback);
+       form_reset_errors();
     }
 
     if (typeof second != 'undefined') {