Initialise password fields when loading the page (to prevent the
authorJoey Schulze <joey@infodrom.org>
Fri, 26 Feb 2010 11:50:30 +0000 (12:50 +0100)
committerJoey Schulze <joey@infodrom.org>
Fri, 26 Feb 2010 11:50:30 +0000 (12:50 +0100)
browser to preemptively fill them with data)

lib/functions.js
lib/mask.php

index 72141c2..8554e2b 100644 (file)
@@ -72,6 +72,18 @@ function set_value(id, value)
 /*
  * Form functions
  */
 /*
  * Form functions
  */
+function form_init()
+{
+    var form = document.getElementById('form_edit');
+
+    if (!form) return;
+
+    for (var i=0; i<form.children.length; i++)
+       if (form.children[i].tagName.toLowerCase() == 'input'
+           && form.children[i].type.toLowerCase() == 'password')
+           form.children[i].value = '';
+}
+
 function save_callback(data)
 {
     info('Datensatz gespeichert');
 function save_callback(data)
 {
     info('Datensatz gespeichert');
index 488b62b..03e772d 100644 (file)
 
 function build_form($name, $fields)
 {
 
 function build_form($name, $fields)
 {
+  global $jscode;
   $ret = array();
 
   $ret = array();
 
+  $jscode[] = 'Rico.onLoad( function() {';
+  $jscode[] = "form_init();";
+  $jscode[] = '});';
+
   $ret[] = '<div class="form">';
   $ret[] = '<p id="form_title">Datensatz bearbeiten</p>';
   $ret[] = '<form id="form_edit">';
   $ret[] = '<div class="form">';
   $ret[] = '<p id="form_title">Datensatz bearbeiten</p>';
   $ret[] = '<form id="form_edit">';