I've this criteria:
1. Users have to fill in 3 fields, VCompany, VName, VCountry.
2. They are allowed to have multi-value in each of these fields because there can be more than one company or more than one person from the same company.
3. When they click on the Add button, all 3 values (1 entry at a time) will be updated to a listbox (maybe in this format: Company A, Billy Goh, China). The next entry shall be in the same way.
4. If they were to enter the wrong entry, they have to option to delete that particular entry from the listbox.
Can these be done? I remember something about delimiters, is comma one of them? If not, can I use tab (\n) in the listbox instead?
To start off, this is the code that I have in mind:
Code:
function addToList()
{
var f = document.forms[0];
for (i = 0; i < f.ListBox.length; i++)
{
f.ListBox[i].value = f.VCompany.value + "\t" + f.VName.value + "\t" + f.VCountry.value;
}
}
I may be using the wrong code. I think I should be inserting new element in the last index whenever they click on Add, correct?