Workflow on form validation

Workflow on form validation

I've added a workflow to extend my validation but it doesn't work.

I have no idea why it is not working:
Steps I've taken:
  1. Add workflow
  2. Select form to apply workflow on
  3. In my case I want to apply the workflow on Create and Edit
  4. And the next step is my line of code. But when I submit the form with one of the selected values, nothing happens, I don't get any alert. Not even when I just add an alert on top of my file so I am stuck on this. Please help me

  1. if(input.CompanyType.Name == "reseller" || input.CompanyType.Name == "customer")
  2. {
  3. EmptyBilling_Address = null;
  4. EmptyBank = null;
  5. EmptyIBAN = null;
  6. EmptyBIC = null;
  7. EmptyFields = "";
  8. if(input.Billing_address == null)
  9. {
  10. EmptyBilling_Address = true;
  11. }
  12. if(input.Bank == null)
  13. {
  14. EmptyBank = true;
  15. }
  16. if(input.IBAN == null)
  17. {
  18. EmptyIBAN = true;
  19. }
  20. if(input.BIC == null)
  21. {
  22. EmptyBIC = true;
  23. }
  24. if(EmptyBilling_Address == true || EmptyBank == true || EmptyIBAN == true || EmptyBIC == true)
  25. {
  26. if(EmptyBilling_Address == true)
  27. {
  28. EmptyFields = "Required field: ".concat("Billing address <br>");
  29. }
  30. if(EmptyBank == true)
  31. {
  32. EmptyFields = "Required field: ".concat("Bank<br>");
  33. }
  34. if(EmptyBIC == true)
  35. {
  36. EmptyFields = "Required field: ".concat("BIC\n");
  37. }
  38. if(EmptyIBAN == true)
  39. {
  40. EmptyFields = "Required field: ".concat("IBAN\n");
  41. }
  42. }
  43. if(EmptyFields != "")
  44. {
  45. alert EmptyFields;
  46. cancel submit;
  47. }
  48. }