I got the "New user form". There are three different clearence levels:
- client
- clientContact
- clientRepresentative
And there are some fields, like newMail, newPostalCode, etc.
Here is a code I am using to show an element:
function doShow(obj) {
document.getElementById(obj).style.display = '';
}
And a code I am using to hide an element:
function doHide(obj) {
document.getElementById(obj).style.display = 'none';
}
It works for small blocks of data. While creating an user, the clearence level is specified, if it is clientRepresentative the appropriate field is being shown. In example, client has only one e-mail adress, clientRepresentative has two e-mail addresses and clientContact has three.
But this don't work!. If I choose client, there is one e-mail, just as planned, but if I choose clientContact and then switch to clientRepresentative the redundant field (e-mail3) is not being hidden.
I believe this is a JavaScript issue, please help me, since my anger level hits the ceiling.
edit: I forgot to paste function used to show/hide the items.
if (clearenceLevel != "Chose...") {
if (clearenceLevel == "client") {
doShow("newMail");
doHide("newMail2");
doHide("newMail3");
doShow("newNip");
doShow("newRegon");
doShow("newStreet");
doHide("newHeadquarters");
doShow("newAddress");
doShow("newPostalCode");
doShow("kptekst");
doShow("newCity");
doShow("newAccount");
doShow("newState");
doHide("newStatus");
doHide("newPassword");
} else if (clearenceLevel == "clientRepresentative") {
doShow("newMail");
doShow("newMail2");
doHide("newStatus");
doHide("newMail3");
doHide("newNip");
doHide("newRegon");
doHide("newStreet");
doHide("newHeadquarters");
doHide("newAddress");
doHide("newPostalCode");
doHide("newCity");
doHide("newAccount");
doHide("newState");
doHide("kptekst");
doShow("newPassword");
} else if (clearenceLevel == "clientContact") {
doShow("newMail");
doShow("newMail2");
doShow("newMail3");
doHide("newNip");
doHide("newRegon");
doHide("newStatus");
doHide("newStreet");
doHide("newHeadquarters");
doHide("newAddress");
doHide("newPostalCode");
doHide("newCity");
doHide("newAccount");
doHide("newState");
doHide("kptekst");
doHide("newPassword");
}
}