Rule Validation For List Of Value

Hi All,

I have no idea on how to create a rule to validate this situation,

I have a table named Lot, it contains

Lot


id PK

name

description

foremans

supervisor

status

and

Person


id PK

type ‘0: foreman; 1: supervisor’

name

mobile

memo

status

I fill the foremans and supervisor field on Lot by using autocomplete that got values from Person table.

It used to be foremans can only by filled by one name, so the validation is easy by using exist. However, now, the rquirement has changed. It can only be filled by at most two people.

I can using autocomplete for many value and set the limit to 2. But how could I do the validation? Although, I use autocomplete to fill foremans and supervisor, I am still wanting to validate that the person is exist in Person table. How could we validate lists?

Thank you in advance.

Daniel

Hi,

I think … in this case … instead of one time exist checking… u have to do 2 times exist checking…

Anyway u have filtered two values. so everytime u can check …if both are already in database… dont allow to add any more

if one thing is there and another is not there allow to add which does not exist

Thank you for your response.

However, what I am looking for is to do something like exist that works for an array. I think the input for foreman would be something like "Andi, Ahmad". That I can make it as array. Does exist works for array?