1

I am new to working with SP lists with jQuery. Here is my requirement :

I have a InfoPath form for selecting training slot for employees. The form contains Date field and Time slots (Drop down having 4 time slots per day)

I would like to set the maximum number of seats per slot to 4. When the fifth user is trying to select the same slot it should be disabled for the user.

How can I achieve this using jQuery?enter image description here

0

You can do this with OOB infopath checkboxes, I"m not sure about DropDowns though.

Add your list as a data connection. And then create a field for each particular time slot. call it something like "CountTimeSlot1" and etc for all of the time slots. Then set the value of each field equal to the formula Count(find your field in the data connection section and add a filter so it only counts the number of times the field is equal to that time slot.)

Now that you have a counter for each Time slot. Add rules to each checkbox for when the corresponding Counter field is equal to 4, to disable the checkbox.

  • Hi Ramana, Thanks for this answer. It works fine . it calculates only the number of occurences of Time slot. I need to get count of the same on specific Date. Lets say for today(08/06/2016) date there should be only 4 occurences for specifc Time slot. So it should also compare Date field. How it can be achieved. Please advise – Peter Solomon Jun 8 '16 at 16:45
  • @PeterSolomon This is a easy fix. Just go to the area where you added in the filter condition, click "AND" and add in another condition that checks to see if the date in your list is equal to the date field you are checking for. For example your counter will pull the count everything from the list where Time Slot is equal to the Timeslot you are checking for, and date is equal to your date field you are checking for. – Ramana Viswanadha Jun 8 '16 at 17:07
  • Hi Ramana, I tired this but it didnt give actual results . It still pulls sum of all the results where the comparision with Date field is failed. – Peter Solomon Jun 10 '16 at 14:13
  • Peter can you add a screenshot of how you set up your Query/Rule. – Ramana Viswanadha Jun 10 '16 at 14:15
  • Hi Ramana, Please find the screenshot in original post. – Peter Solomon Jun 10 '16 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.