PDA

View Full Version : I need help with listbox


bonechair
12-04-2002, 06:06 AM
You can see it in action at http://www.martialdesigns.com/rules/
The listbox is not getting cleared correctly.
When you click on www you get
Rulename:www
Rulename:www2
And when clicked on others it does not clear the listbox fully..

Heres some of the code

// function to GET DATA from address book into listbox
// isAdd = true if user has just added a new record
function dataLoad(isAdd) {
var sLabel, i;

lvAddressData.onLoad = function() {
lbxAddressDisplay.removeAll();

combo1.removeAll();
combo1.addItem("Assign To?",11);
for (i=0; i<this.n; i++) {




if (this["thename"+i] == null){
}
else {
combo1.addItem(padr(this["thename"+i]),padr(this["thedata"+i]));
}

if (this["rulename"+i] == null){
}
else {

sLabel = "Rulename: " + padr(this["rulename"+i]);
lbxAddressDisplay.addItem(
sLabel,
{id:this["id"+i],
date:this["date"+i],
time:this["time"+i],
user:this["user"+i],
flowid:this["flowid"+i],
pid:this["pid"+i],
sip:this["sip"+i],
dip:this["dip"+i],
smask:this["smask"+i],
dmask:this["dmask"+i],
sport:this["sport"+i],
dport:this["dport"+i],
rulename:this["rulename"+i],
prio:this["prio"+i],
adv1:this["adv1"+i],
adv2:this["adv2"+i],
adv3:this["adv3"+i],
shared:this["shared"+i],
shared:this["shared"+i]

}

);

}


}
if (!isAdd) {
dtfMsg.text = this.n + " Records are loaded. Click any record to view, edit or delete it, or click the Add Record button to add a new one.";
} else {
dtfMsg.text = "Record has been added. Enter a new record and click Save to save it, or click any record to view, edit or delete it.";
}
// clear record editing fields
for (i in gaFields) {
mcFields["dtf" + gaFields[i].name].text = '';
}
}

lvAddressData.cond = gsFilter;
lvAddressData.tab = gsFilter2;
//trace("condition = " + lvAddressData.cond);
lvAddressData.sendAndLoad(sFileLoc + "love.php", lvAddressData, "POST");
//lvAddressData.send(sFileLoc + "love.php", "newwin", "POST");

}

// function to set global filter variables according to user's choice
function checkFilter(compPassed) {
gsFilter = compPassed.getSelectedItem().data;
dtfMsg.text = "Loading records for " + compPassed.getSelectedItem().label;
// clear fields and hide buttons which might have been previously displayed for
// a selected record
for (var i in gaFields) {
mcFields["dtf" + gaFields[i].name].text = '';
}
btnSaveChanges._visible = false;
btnDeleteRecord._visible = false;
// update display
lbxAddressDisplay.removeAll();
dataLoad(false);

}

cboFilter.setChangeHandler("checkFilter", this);

function checkFilter2(compPassed) {
gsFilter2 = compPassed.getSelectedItem().data;
lbxAddressDisplay.removeAll();
dataLoad(false);

}
combo1.setChangeHandler("checkFilter2", this);

if you want to see the full actionscript
YOu can download it at http://www.martialdesigns.com/rules/getiface.as
and
http://www.martialdesigns.com/rules/index.as

I do include the
lbxAddressDisplay.removeAll();
So I donot know whats wrong.
Any help will be greatly appreciated

Thanks
Louis

bonechair
12-04-2002, 10:17 AM
Sorry


// function to GET DATA from address book into listbox
// isAdd = true if user has just added a new record
function dataLoad(isAdd) {
var sLabel, i;

lvAddressData.onLoad = function() {
lbxAddressDisplay.removeAll();

combo1.removeAll();
combo1.addItem("Assign To?",11);
for (i=0; i<this.n; i++) {




if (this["thename"+i] == null){
}
else {
combo1.addItem(padr(this["thename"+i]),padr(this["thedata"+i]));
}

if (this["rulename"+i] == null){
}
else {

sLabel = "Rulename: " + padr(this["rulename"+i]);
lbxAddressDisplay.addItem(
sLabel,
{id:this["id"+i],
date:this["date"+i],
time:this["time"+i],
user:this["user"+i],
flowid:this["flowid"+i],
pid:this["pid"+i],
sip:this["sip"+i],
dip:this["dip"+i],

smask:this["smask"+i],
dmask:this["dmask"+i],
sport:this["sport"+i],
dport:this["dport"+i],
rulename:this["rulename"+i],
prio:this["prio"+i],
adv1:this["adv1"+i],
adv2:this["adv2"+i],
adv3:this["adv3"+i],
shared:this["shared"+i],
shared:this["shared"+i]

}

);

}


}
if (!isAdd) {
dtfMsg.text = this.n + " Records are loaded. Click any record to view, edit or delete it, or click the Add Record button to add a new one.";
} else {
dtfMsg.text = "Record has been added. Enter a new record and click Save to save it, or click any record to view, edit or delete it.";
}
// clear record editing fields
for (i in gaFields) {
mcFields["dtf" + gaFields[i].name].text = '';
}
}

lvAddressData.cond = gsFilter;
lvAddressData.tab = gsFilter2;
//trace("condition = " + lvAddressData.cond);
lvAddressData.sendAndLoad(sFileLoc + "love.php", lvAddressData, "POST");
//lvAddressData.send(sFileLoc + "love.php", "newwin", "POST");

}

// function to set global filter variables according to user's choice
function checkFilter(compPassed) {
gsFilter = compPassed.getSelectedItem().data;
dtfMsg.text = "Loading records for " + compPassed.getSelectedItem().label;
// clear fields and hide buttons which might have been previously displayed for
// a selected record
for (var i in gaFields) {
mcFields["dtf" + gaFields[i].name].text = '';
}
btnSaveChanges._visible = false;
btnDeleteRecord._visible = false;
// update display
lbxAddressDisplay.removeAll();
dataLoad(false);

}

cboFilter.setChangeHandler("checkFilter", this);

function checkFilter2(compPassed) {
gsFilter2 = compPassed.getSelectedItem().data;
lbxAddressDisplay.removeAll();
dataLoad(false);

}
combo1.setChangeHandler("checkFilter2", this);