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:
- Add workflow
- Select form to apply workflow on
- In my case I want to apply the workflow on Create and Edit
- 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
- if(input.CompanyType.Name == "reseller" || input.CompanyType.Name == "customer")
- {
- EmptyBilling_Address = null;
- EmptyBank = null;
- EmptyIBAN = null;
- EmptyBIC = null;
- EmptyFields = "";
- if(input.Billing_address == null)
- {
- EmptyBilling_Address = true;
- }
- if(input.Bank == null)
- {
- EmptyBank = true;
- }
- if(input.IBAN == null)
- {
- EmptyIBAN = true;
- }
- if(input.BIC == null)
- {
- EmptyBIC = true;
- }
- if(EmptyBilling_Address == true || EmptyBank == true || EmptyIBAN == true || EmptyBIC == true)
- {
- if(EmptyBilling_Address == true)
- {
- EmptyFields = "Required field: ".concat("Billing address <br>");
- }
- if(EmptyBank == true)
- {
- EmptyFields = "Required field: ".concat("Bank<br>");
- }
- if(EmptyBIC == true)
- {
- EmptyFields = "Required field: ".concat("BIC\n");
- }
- if(EmptyIBAN == true)
- {
- EmptyFields = "Required field: ".concat("IBAN\n");
- }
- }
- if(EmptyFields != "")
- {
- alert EmptyFields;
- cancel submit;
- }
- }