1,380 Views | View blog reactions

JSCRIPT 3

Posted on November 26th, 2007 in JSCRIPT by Seidl Michael | 1,380 Views

After a long time, I will work again on this site, and I will give you more Samples and News. The next Days there will be a few Samples of Jscript Codes, after that I will give you some News about CRM 4.0, so I am back again.

So this is a little Script, which checks the Values in a particular Field, so you can get sure, that only useful Values will be entered. I took the Salutation Field, to check the entered Values.

There is something more new, in the past, there were a lot of Problems with code-samples on this Page, so i decide to put the Code in a Text-File where you can download it with no errors.

JAVASCRIPT [Show Plain Code]:
  1. //At first, we create an Array, that will be filled with your parameters we want to check
  2. var array1=new Array(2);
  3. array1[0]="Mr";
  4. array1[1]="Mrs";
  5. array1[2]="Mr and Mrs";
  6.  
  7. var check1=crmForm.all.salutation.value;
  8. var x = 0;
  9. var y = 0;
  10.  
  11. //That’s the For-Loop, which will check our field with our parameters, if there is anything wrong, alert will come up.
  12. for (x=0; x<3; x++)
  13.   {
  14.     if (check1 == array1[x])
  15.       {
  16.         ende1();
  17.         break;
  18.       }
  19.     else
  20.       {
  21.         y=y+1
  22.       }
  23.   }
  24.  
  25. if (y > 2)
  26.   {
  27.       alert("The Field SALUTATION is filled wrong \n That’s the write Values: \n Mr, Mrs, Mr and Mrs");
  28.       event.returnValue = false;
  29.       return false;
  30.   }
  31.  
  32. function ende1()
  33. {
  34. }

Link for Download: DOWNLOAD