Bug 290024 Address Book vanishes if it is renamed as blank

p=bugzilla@standard8.demon.co.uk r=neil.parkwaycc.co.uk sr=bienvenu a=chofmann
This commit is contained in:
bugzilla%arlen.demon.co.uk 2005-05-02 11:11:11 +00:00
parent 470df97578
commit 17b8ae80ba
4 changed files with 35 additions and 14 deletions

View File

@ -1,11 +1,15 @@
var okCallback = 0;
var gCanRename = true;
var gOkButton;
var gNameInput;
function abNameOnLoad()
{
var abName = "";
gOkButton = document.documentElement.getButton('accept');
// look in arguments[0] for parameters
if ("arguments" in window && window.arguments[0])
{
@ -23,25 +27,31 @@ function abNameOnLoad()
}
// focus on input
var name = document.getElementById('name');
if (name) {
gNameInput = document.getElementById('name');
if (gNameInput) {
if (abName)
name.value = abName;
gNameInput.value = abName;
if (gCanRename)
name.focus();
gNameInput.focus();
else
name.disabled = true;
gNameInput.disabled = true;
}
abNameDoOkEnabling()
moveToAlertPosition();
}
function abNameOKButton()
{
if (top.okCallback && gCanRename)
top.okCallback(document.getElementById('name').value);
top.okCallback(gNameInput.value.replace(/^\s+|\s+$/g, ''));
return true;
}
function abNameDoOkEnabling()
{
gOkButton.disabled = !/\S/.test(gNameInput.value);
}

View File

@ -50,7 +50,7 @@
<hbox align="center">
<label control="name" value="&name.label;"/>
<textbox tabindex="0" id="name"/>
<textbox tabindex="0" oninput="abNameDoOkEnabling();" id="name"/>
</hbox>
</dialog>

View File

@ -1,10 +1,14 @@
var okCallback = 0;
var gCanRename = true;
var gOkButton;
var gNameInput;
function abNameOnLoad()
{
var abName = "";
gOkButton = document.documentElement.getButton('accept');
// look in arguments[0] for parameters
if ("arguments" in window && window.arguments[0])
{
@ -22,24 +26,31 @@ function abNameOnLoad()
}
// focus on input
var name = document.getElementById('name');
if (name) {
gNameInput = document.getElementById('name');
if (gNameInput) {
if (abName)
name.value = abName;
gNameInput.value = abName;
if (gCanRename)
name.focus();
gNameInput.focus();
else
name.disabled = true;
gNameInput.disabled = true;
}
abNameDoOkEnabling()
moveToAlertPosition();
}
function abNameOKButton()
{
if (top.okCallback && gCanRename)
top.okCallback(document.getElementById('name').value);
top.okCallback(gNameInput.value.replace(/^\s+|\s+$/g, ''));
return true;
}
function abNameDoOkEnabling()
{
gOkButton.disabled = !/\S/.test(gNameInput.value);
}

View File

@ -50,6 +50,6 @@
<hbox align="center">
<label control="name" value="&name.label;" accesskey="&name.accesskey;"/>
<textbox id="name" flex="1"/>
<textbox id="name" oninput="abNameDoOkEnabling();" flex="1"/>
</hbox>
</dialog>