Rules validation failure


Badge +5

I need someone to point in the correct direction. Been hammering at this form half the day and am not seeing what I am doing wrong. I have a field called "Contact" if it is empty throw up a flag saying Required. This works fine. I have another field called "Contact Number". I have been setting a rule stating (using Item Property or Named Control) Point_of_Contact!="" then throw up flag as required. If I use the Item property it does not even flag as being required on submit. If I use the Named control it throws the flag and if I fill out the field it still is requiring to fill it out even though there  is information in the field. I have several other fields that need to have a similar rule set based on input from another.


8 replies

Badge +5

I just tried not(isNullorEmpty(Point_of_contact)) and still get the same issue. As if the form does not see input put into the field. From what I understand both formulas mean the same thing. If I use Contact_Number=="" then the validation works just because the field its self is not empty. Why won't the form validation work if I base it on another field if that field is not empty require, if we have information or enter a value then look at field validation to take control to validate if I have a 10 digit number (which works fine).

Update**

Think I figured it out....

I am telling the validation if the field is NOT empty then require, and since the field is actually NOT empty it will continue to require regardless. So I need to figure out how to validate that once input is in the Point of Contact field to flag Contact Number for input and once input is in then disregard rules.

Userlevel 5
Badge +14

item properties provide item values saved in list and actual at the moment form is opened.

so for NEW form they are always empty, since there is not respective item yet.

for EDIT form they provide list item's value as mentioned above. this value do not follow changes in form controls.

so, (usually) you need to build validation rules on form control values (named controls) to check actual values seen in form.

So I need to figure out how to validate that once input is in the Point of Contact field to flag Contact Number for input and once input is in then disregard rules.

I understand this as follows:

- if 'Point of contact field is empty, 'Contact Number' flag shuldn't be shown (regardles of content of 'Contact Number' field)

- if 'Point of contact field is filled in and  'Contact Number'  is empty, 'Contact Number' flag shuldn be shown 

- if both 'Point of contact and  'Contact Number'   fields are filled in, 'Contact Number' flag shuldn't be shown

this requirements should be satisfied with following rule

not( isNullorEmpty(Point_of_contact) && isNullorEmpty(Contact_Number) )

to hide 'Contact Number' flag

Badge +5

Marian,

First of all THANK YOU, Before I left work last night had this epiphany as well and you just confirmed it. I did try it but ... I tried this and it still came back to requiring input.


I understand this as follows:

- if 'Point of contact field is empty, 'Contact Number' flag shuldn't be shown (regardles of content of 'Contact Number' field)

- if 'Point of contact field is filled in and  'Contact Number'  is empty, 'Contact Number' flag shuldn be shown 

- if both 'Point of contact and  'Contact Number'   fields are filled in, 'Contact Number' flag shuldn't be shown

to hide 'Contact Number' flag

Actually what is needed is

If 'Point of Contact' field is empty and 'Contact Number' field is empty then flag should be shown to require input

If 'Point of Contact' field is filled and 'Contact Number' field is empty then flag should be shown to require input

if If 'Point of Contact' field is filled and 'Contact Number' field is filled then flag shouldn't be shown to require input.

So mainly, the middle option is the criteria I am after.

Userlevel 5
Badge +14

and what should happen if 'Point of Contact' field is empty and 'Contact Number' field is filled?

Badge +5

I have a form validation rule that looks to see if 'Point of Contact' is empty', that works correctly with no issues. If POC field is empty the validation rule runs and highlights the field (as should be expected). Contact Number says highlighted even though input has been entered and Submit is pressed. I would expect the Contact Number field to not have the requirement anymore (forcing needed input).

Update**

I GOT IT !!!!!

I had to turn the validation rule around
isNullOrEmpty(Contact_Number)&&not(isNullOrEmpty(Point_of_Contact))

now if form is submitted with no POC it flags the POC being required. Once POC is entered and submitted it flags the Contact Number to be required. Once the Contact Number is entered and submitted the field no longer is highlighted and required...

THANK YOU ..... THANK YOU .. THANK YOU

Userlevel 5
Badge +14

hm, fine if you got it working as you wanted.

but to be honest I'm confused with what you requested and what you ended up with...

now if form is submitted with no POC it flags the POC being required.

if POC is empty, your formula evaluates to false and so validation rule passes through silently, ie nothing should be shown/highlighted.

so what you mean with "it flags the POC being required" in that case???

Badge +5

I have to run, but will answer this on Sunday when back to work. I am not trying to be inconsiderate but I am on a tight schedule.

** Update **

So to be clear what I have is a Validation rule set on the POC  field first and foremost to see if that is empty and if so then Flag (Highlight) and show required.

If it is not then the form rule kicks in that states if Contact Number is empty and POC is not empty then flag required. If the form sees that POC is not empty and Contact Number is not empty then proceed with next fields and validation. This is one of those, I wished I had paid more attention in Algebra class. I always mixed my positive and negatives, I would have the right answer just the wrong side of the spectrum. Seems I carried it over to these formulas as well.

If there is one thing I loved in the past, was learning code to put together actions, like Javascripting, VB and the such. As I get more entwined into the SharePoint world I beginning to enjoy that lost love I had, Learning new coding and how formulas need to be strung together is a challenge for me but I LOVE challenges. Having this site available and having you all chime really helps, even if my starting statement for this particular item seemed un-relevant. After spending half a day wrestling with this it was nice to even just talk it out. I don't have anyone here I can actually do that with.

THANK YOU VERY MUCH

Userlevel 5
Badge +14

no problem at all happy.png

Reply