Maybe this isn’t actually a problem, but I’m still a newbie so I don’t know. As one of my first projects, I’m putting together a simple contact manager so that I can wean some of our users off Now Contact. I’m trying to duplicate the way Now Contact can attach a keyword to a contact. I put the keywords into a value list, and attached them to a comboBox. In the onDataChange method, I put the code below. It is supposed to add the keyword to the contact if it doesn’t already exist, and delete the keyword if it does exist. The code does all that, but at the end, I want it to reset the global variable the combo box is connected to back to ‘Select…’ It won’t do it. Whenever I chose an option from the comboBox, it adds or deletes the keyword correctly, but then it remains set to whatever I selected, it doesn’t reset to ‘Select…’. Maybe its just not possible to change the underlying global variable in the onDataChange method? If so, is there a better way to do this?
Thanks for your help!
-Shane
function onDataChangeKeyword(oldValue, newValue, event) {
var keyWordCount = contacts_to_keywords.getSize();
var keyWordExists = 0;
for (var i = 1; i <= keyWordCount; i++ )
{
contacts_to_keywords.setSelectedIndex(i);
if (contacts_to_keywords.keyword == newValue)
{
keyExists = 1;
contacts_to_keywords.deleteRecord();
}
}
if (keyWordExists == 0)
{
contacts_to_keywords.newRecord();
contacts_to_keywords.keyword = newValue;
}
var v_SelectKey = 'Select...';
return true
}