This topic is locked

Limit Item Selections

5/10/2007 3:31:12 PM
PHPRunner General questions
jimhnet author

I have a screen with 5 items on it and I only want to allow the user to select any two of them. How would you best handle it.
Thanks
Jim

J
Jane 5/11/2007

Jim,
the one of the easiest way to limit number of items is to use Before record added event. Here is a sample code:

if (($values["item1"]!="" and $values["item2"]!="") or ($values["item1"]!="" and $values["item3"]!="") or ($values["item1"]!="" and $values["item4"]!="") or ($values["item1"]!="" and $values["item5"]!="") or ($values["item2"]!="" and $values["item3"]!="") or ($values["item2"]!="" and $values["item4"]!="") or ($values["item2"]!="" and $values["item5"]!="") or ($values["item3"]!="" and $values["item4"]!="") or ($values["item3"]!="" and $values["item5"]!="") or ($values["item4"]!="" and $values["item5"]!=""))

return true;

else

return false;


Also you can limit number of items on the fly using custom JavaScript code.