So I have been playing with the IF statement for quite some time now and from time to time it fails me. Generally it fails me when I am trying to do three or more conditions. I attempted to do some nested IF statements and Jon from our developer support group steered me to the straight and narrow. :-) So don't make fun of me for my mediocre coding skills. :-)
So instead of doing an IF, how does this look for cleaner code? You can then take on as many different scenarios as you want.
var prefix = "";switch (crmForm.all.customertypecode.SelectedText){ case "Manufacturer": prefix="MFG"; break; case "Investor": prefix="INV"; break; case "Press": prefix="SCUM"; break; default: break;}
var prefix = "";switch (crmForm.all.customertypecode.SelectedText){ case "Manufacturer": prefix="MFG"; break; case "Investor": prefix="INV"; break;
case "Press": prefix="SCUM"; break; default: break;}
Here is a link to the MSDN page that has a ton more details on the switch command. Enjoy!
switch Statement (JScript 5.6)