cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Form Validation Failing - Not Consistent

I am working on a SharePoint form that has multiple validation options based on end user selection. There are about 13 options (drop-down) in total and I am having a similar issue with about 3 of them: the validation is acting erratically. The code for one is below. I have tried several things to fix the issue:

  • Retyping the code
  • Removing and rebuilding the fields from the SharePoint side
  • Breaking them up into multiple rules

No mater what I still get the same or similar end result: The validation treats the code as if there are separate. Once the first group is filled in (Up to Zip Code) the form then can save with the balance being empty. There are other validation rules that use some of the same fields and it's ok for them. Not sure what to do. I did read post regarding an know issue with Content Types and this type of errors being produced.  REVIEW TYPE is the trigger.

ReviewType=='Available Capacity'&&(isNullOrEmpty(trim(CustomerCompanyName))||isNullOrEmpty(trim(ResourceCenterDistrictLocation))||isNullOrEmpty(trim(StreetAddress))||isNullOrEmpty(trim(ZipCode))||isNullOrEmpty(trim(HourlyLoad))||isNullOrEmpty(HourlyLoadUnits)||isNullOrEmpty(trim(DailyLoad))||isNullOrEmpty(DailyLoadUnits)||isNullOrEmpty(trim(DeliveryPressurepsig)))

The form

When the user has to enter data initially:

Initially B

Initially A

After some data filled in: *IF anything in the top group is not filled in then the validation fails but if they are filled in it lets the user save even if none of the ones below are populated.

This should be still not valid: but the user can save

Labels: (2)
0 Kudos
Reply
24 Replies
Workflow Hero

Re: Form Validation Failing - Not Consistent

0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

Looking at the code you have provided: 

ReviewType == 'Available Capacity' && 
(
  isNullOrEmpty(trim(CustomerCompanyName)) ||
  isNullOrEmpty(trim(ResourceCenterDistrictLocation)) ||
  isNullOrEmpty(trim(StreetAddress)) ||
  isNullOrEmpty(trim(ZipCode)) ||
  isNullOrEmpty(trim(HourlyLoad)) ||
  isNullOrEmpty(HourlyLoadUnits) ||
  isNullOrEmpty(trim(DailyLoad)) ||
  isNullOrEmpty(DailyLoadUnits) ||
  isNullOrEmpty(trim(DeliveryPressurepsig))
)

The only thing that sticks out is the missing 'trim' functions from two of your arguments.

That being said, it might be a lot easier to figure out what's happening if you just gave each Control its own Rule written simply like: 

ReviewType === 'Available Capacity' && isNullOrEmpty(trim({Control:Self}))

Being that, that's all you seem to actually be checking for each one of these Controls. 

0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

Thanks for the reply! 

  • I left the TRIM off  two of the controls because they are drop downs 
  • The thing about this form is that is is just one of 13 options   And the whole thing is not valid is ANY of them are not populated (In this case for Available Capacity) 
  • I did test a while back by breaking into smaller "groups" - tow validations and running. SAME result even though they were not in the same statement
  • I also went as far as deleting all the controls in that section and re-adding them 
  • The ODD thing is since testing Available Capacity by removing the TRIM - it works. EXCEPT users can enter a blank apace   
    • I was thinking of adding a RegEx component to the control itself but so far I am not able to make it work  
0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

I guess maybe I'm not understanding something. 

  • Could you maybe describe how / where you are applying the rule code from above?
  • Are you putting that rule on all of your controls? 
  • Do you also want to account for whatever values exist in the ReviewType control?
  • You seem to suggest that the controls should be invalid if they are blank... if that's the case, then why does it matter what the value of ReviewType is? 
0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

  • As of right now there are rules for each option: The form has 13 "options" that each have a specified set of required fields.  Each review type has varying "Required" fields 
    • So the ReviewType== is each review type 
  • The rules above are all done using the Rules panel:  
    • NAME: Rule Type: Validation Condition....
  • Each individual control currently has no validation attached to them directly in the Control Settings 
    • I was going to see IF perhaps I could find a work around for the Blank space issue by adding a RegEX to the control itself...
0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

  • Each individual control currently has not validation attached to them
    • I was going to see IF perhaps I could find a work around for the Blank space issue by adding a RegEX to the control itself...

You seem to be indicating that each control does not have validation set on it. If that is the case, do you just have (13) different rules all placed on a single control? Is that control the ReviewType control itself? If that's the case, how are you highlighting the controls that are 'invalid'? Either way, this approach could cause problems I'd imagine. 

Additionally, when you wrote the Rule were using the Item Property or the Named Control value from the Formula Builder? Selecting one over the other could cause all sorts of problems as the Item Property references the value of a Column in SharePoint as it is right now, while a Named Control references the value of the Form Control as named. 


0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

Going to send Screenshots. 

Each "Option" has: 

  • Two formatting rules: 
    • One - Highlights the Control Name that is required 
    • The other - Hides the controls not necessary for the selection 
  • One validation rule: 
    • If RequestType == "ABC" then fill in the Required items (visually know by the control name being red)
  • The validation rules themselves are not necessarily tied to the individual controls but react using the RequestType 
    • So AvailableCapacity affected approx 9 controls 
    • Another Option may only affect 7, etc 
  • I am using the Named Controls in each instance 
    • "Selecting one over the other could cause all sorts of problems as the Item Property references the value of a Column in SharePoint as it is right now, while a Named Control references the value of the Form Control as named. "
0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

ReviewType Options

Options for Review Type 

Rules

Home for all the Validations - Currently NONE on individual controls 

0 Kudos
Reply
Workflow Hero

Re: Form Validation Failing - Not Consistent

Non applicable fields

Non Applicable Fields 

Required Fields

Required Fields 

Required Fileds w Error

Required Fields not filled in - ERROR 

0 Kudos
Reply