Hello there,
I've made a simple Dashcode app which works fine on iOS devices.
It works fine in the Android emulator running on OSX. Yet on the
actual Nexus 7 device with chrome it has a strange error.
I have a Password Field which when typed into calls a bit of Javascript
to do a change 'My Pass' -> '** Pass' -> '*******'.
On the Nexus device it does this '*' -> 'M*' -> 'My*' -> 'My Pas*'.
Any ideas what I'm doing wrong?
LB
I've made a simple Dashcode app which works fine on iOS devices.
It works fine in the Android emulator running on OSX. Yet on the
actual Nexus 7 device with chrome it has a strange error.
I have a Password Field which when typed into calls a bit of Javascript
to do a change 'My Pass' -> '** Pass' -> '*******'.
On the Nexus device it does this '*' -> 'M*' -> 'My*' -> 'My Pas*'.
Any ideas what I'm doing wrong?
LB
Code:
function passwordCharChange(event)
{
var newstr;
//
// txt - Text in edit box so far
//
var textFieldValue = document.getElementById("textField");
var txt = textFieldValue.value;
//
// len - Length of Saved password so far
//
var len = g_pw.length;
while ( txt.length > g_pw.length)
{
//
// There is (still) more text in the edit field than in Saved PW.
//
//console.log( "Change: g_pw " + g_pw + " text field " + txt );
//
// Add 1 char to the end of Saved PW.
//
g_pw = g_pw + txt.charAt(len);
//
// substr(start,length) returns a sub string.
// Replace one character in the textField with '*'
//
newstr = txt.substr(0,len) + '*' + txt.substr(len+1);
//
// update temp values
//
txt = newstr;
len = g_pw.length;
}
if (g_pw.length > txt.length)
{
//
// Saved PW is bigger than in textField. So truncate it.
//
g_pw = g_pw.substr(0, txt.length);
}
//
// Set modified text back into textField
//
textFieldValue.value = txt;
}