Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
Say, I have a list box with 10 items. How should I limit the selections up to 5 only?
Thanks in advance and more power!
Jason ^^
Hi Jason,
I think you can do this by adding a trigger that fires everytime the user makes a selection for the field. The trigger tests the count of values in the field and if it's >5, then the trigger clears the selection for the field.
For an example I used a field named YEAR. So in Document Properties -- Triggers tab, add a Field Event Trigger for the OnSelect event for the field YEAR.
Use the Action "Select In Field". For "Field" I entered =if(count(YEAR))>5,'YEAR','') for "Search String" I entered just an equals sign.
So if the count(YEAR) is > 5 then the trigger clears the selection on the field YEAR. If <= 5 the trigger does nothing.
regards,
Paul
Jason
Interesting thought but I don't think it can be done, as a matter of interest, why would you want to do it as there might be another way to provide a solution.
Regards,
It can be done by a macro. It should count the slected values, and if it's >5, produce a message, and maybe apply some default selection.
Hi Jason,
I think you can do this by adding a trigger that fires everytime the user makes a selection for the field. The trigger tests the count of values in the field and if it's >5, then the trigger clears the selection for the field.
For an example I used a field named YEAR. So in Document Properties -- Triggers tab, add a Field Event Trigger for the OnSelect event for the field YEAR.
Use the Action "Select In Field". For "Field" I entered =if(count(YEAR))>5,'YEAR','') for "Search String" I entered just an equals sign.
So if the count(YEAR) is > 5 then the trigger clears the selection on the field YEAR. If <= 5 the trigger does nothing.
regards,
Paul
Here's an example I had lying around using the macro approach. It forces at least one selection, and doesn't allow more than 5 selections. Easy enough to remove the "at least one selection" part of it.
Thank you all for the quick and wonderful answers. I really appreciate it. Thanks John for the example, this is what I'm looking for.
jason