0

I have a very simple list, 2 columns actually. "Name" and "Table".

Its for users to reserve a table at an event. "Name" is free text and "Table" is a selection drop down

There are obviously a limited number of seats on each table and I would like to limit the reservation to 10 per table. Trouble is I don't know how! :-)

  • What are user's actually selected from the Table drop-down? The table number? What are the drop-down choices? – Submits Oct 7 '15 at 9:25
  • it is a drop down and its just a number. "1" = Table 1, "2" = Table 2, etc.. – SimonW Oct 7 '15 at 9:52
  • A number representing what? Table number? – Submits Oct 7 '15 at 9:53
  • He wants something that limits an entry.. So when 6 of the 6 seats at a table are claimed, no one can claim a (seventh) seat. Challenge is anyone can claim 1 or more seats – Danny '365CSI' Engelman Oct 7 '15 at 9:54
  • Danny, you have hit the nail on the head – SimonW Oct 7 '15 at 9:57
0

Hmm just thinking, can you do the Name as an appendable multi-line text field and somehow check it with a piece of Javascript, if it already has 10 rows, don't let it be submitted.

  • I don't think that would work, I would have to rely on hundreds of users doing it right!! – SimonW Oct 7 '15 at 10:11
0

NewForm.aspx in a SharePoint list has a PreSaveAction() javascript method that can be extended or overridden. For example in your case, on the new item form if a user has selected Table 1 and tried to save then your PreSaveAction() can query the list to count the number of times table 1 have been selected. if the number is equal to 10 then item will not be saved and you can display relevant message to the user that the "Table is fully booked"

function PreSaveAction() {
return checkBookingForTable();
}

function checkBookingForTable()
{
query sharepoint list using REST or CSOM if (bookingCount<10){ retrun true}; else return false;

}

  • and I would insert this in the javascript part in NewForm.aspx? – SimonW Oct 7 '15 at 11:05
  • Yes. Just add a script editior web part to the newform.aspx and put the javascript code inside a script tag. – HarryB Oct 7 '15 at 11:08
  • you can infact keep it style library ,and use its reference. Ways to put your script. Infact this approach should be sufficient for your requirement – Gaurravs Oct 7 '15 at 13:26

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.