0

I´m doing a course catalog app for SharePoint. And I have a list called Courses. In that list I have two columns called: Seats and FreeSeats.

When you make a new course the boss decide how many can apply to the course.

So for ex: 5 seats.

When the Fifth person apply there most be a stop.

So I thought if I have the column FreeSeats, it can count up every-time someone apply. And when it is the same as the column Seats it will NOT be able to apply.

So I guess I need some sort of count that add 1 every-time someone apply to the FreeSeat column. And in a if loop check if the value of FreeSeats are smaller than Seats, you can apply. If its bigger than Seats it will come a stop message.

Someone have any idea how a code like this looks like? I have never done this before.

2
  • I would put together a simple workflow to achieve this. Are you familiar with workflows for SharePoint?
    – Submits
    Commented Dec 4, 2015 at 11:40
  • no not really. But im doing this in Visual Studio. The list and everything is in there :P
    – jacki
    Commented Dec 4, 2015 at 12:40

1 Answer 1

0

Search for: limit items newform or something like that

Basically you have to

  • add a hidden listview to the newform which displays all registered seats

You can then use javascript code to hide the whole form when the maximun is reached

The example somwhere here on SO uses a calculated column

You could also at a content editor webpart which checks ctx.ListData.row.length

2
  • thank you, but i got it to work! :D I don´t show the FreeSeats column for the users. Just use it as a count. When FreeSeats is the same as seats it will not work to sign up for the course anymore. Just needed to make the two columns a int with IntParse and then my code worked! :D But thank you for taking your time to answer :)
    – jacki
    Commented Dec 7, 2015 at 18:51
  • great! Now please mark it answered so you question is removed from the unanswered queue, tnx Commented Dec 7, 2015 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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