Hi guys 
I've spent all day long on this function yesterday, and there is no way I can make it do what's it's supposed to do, which is :
dynamically update the text string while data is typed in the form fields.
If you test it, you'll see that it works only with the last form field. Actually, whatever the number of form fields, it's always the last ones that works
Some help would be very apreciated

I've spent all day long on this function yesterday, and there is no way I can make it do what's it's supposed to do, which is :
dynamically update the text string while data is typed in the form fields.
If you test it, you'll see that it works only with the last form field. Actually, whatever the number of form fields, it's always the last ones that works

Some help would be very apreciated

Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
if (!string) var string = '<br />{admin_name} {admin_surname},<br /><br />{super_admin_surname} {super_admin_name} has created an admin account for you for the online management of {site_public_name}.<br /><br />The administration interface is located here :<br />{site_private_url}<br /><br />Your login : {admin_log}<br />Your password : {admin_pass}<br /><br />Additional comment from {super_admin_surname} {super_admin_name} :<br /><br />{super_admin_comment}<br /><br />';
if (!string_new) var string_new = string;
function message_preview() {
var data_names_array = new Array(
'admin_name',
'admin_surname',
'admin_log'
);
for( var j=0; j < data_names_array.length; j++ ) {
var field_name = 'form_' + data_names_array[j];
var field_value = eval('document.form_admins_register.'+field_name+'.value');
var string_to_replace = '{'+field_name.replace('form_', '')+'}';
string_new = string.replace(string_to_replace, field_value);
}
document.getElementById( 'preview' ).innerHTML = string_new;
}
// End -->
</SCRIPT>
</head>
<body>
<form name="form_admins_register">
<input type="text" name="form_admin_surname" onkeyup = "message_preview()"><br />
<input type="text" name="form_admin_name" onkeyup = "message_preview()"><br />
<input type="text" name="form_admin_log" onkeyup = "message_preview()"><br />
</form>
<br />
<br />
<div id="preview" style="
-moz-box-sizing: border-box;
"></div>
</body>
</html>