The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday noon (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday noon (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Limit number of selections in Autocomplete validation

SOLVED
Go to solution
Highlighted
MVDD
Occasional Advisor

Limit number of selections in Autocomplete validation

Dear experts,

 

I have a Validation on a field of the type Autocomplete with Multiselect enabled.

 

I want to limiit the number of entries that can be selected in this list to two.

 

Can this be done and if so: How?

 

Thanks!

Maurice

3 REPLIES
hyllplan
Frequent Visitor

Re: Limit number of selections in Autocomplete validation

Parse the string with a rule, if more than two values generate a popup explain the restriction to the user.
MVDD
Occasional Advisor

Re: Limit number of selections in Autocomplete validation

thanks hyllplan!

 

Can you give example? Pretty new to this :-)

 

Thanks!

hyllplan
Frequent Visitor
Solution

Re: Limit number of selections in Autocomplete validation

Will try to explain in sequence what I think will work

 

1) lets say user selects three values

2) trigger a rule on field change for that specific multiselect that contains a sql similar to this:

select

REGEXP_COUNT('string to search', '-') + 1

, REGEXP_COUNT('string to search', '-') + 1

from dual;

eg 'string to search' should be the replaced by multiselect field token.

The dash should be replaced by the separator used by ppm multiselect fields

write the result to a hidden field (in this case values: 3    3, ppm  needs two values for a field, one hidden and one visible for user.

3) create another rule that triggers on save that will check the value of the hidden field, generate a popup if the value is equal or more than 3 telling the user that they will need to have a maximum if two values in that specific field. Configure the rule to prevent save, check manual, advanced rules in demand manual or admin guide.

 

you might have to create more rules to capture all scenarios and the behavioir you wish

Good luck!

Johan

//Add this to "OnDomLoad" event