Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list called Tenders. I need to make sure that when Tender status field is set to "open" no one can delete it. Ideally would be if I won't see options in ecb and ribbon. It is not connected to users permissions but with state of list item. Should I use jQuery or is there an easier way?

share|improve this question
add comment

3 Answers

You could create an Event Receiver for the OnDeleting event that prevents the item from being deleted. Basically have the event receiver check for the value of the field and cancel deletion if the right requirements are not met.

share|improve this answer
    
ItemDeleting is the name of the event receiver: msdn.microsoft.com/en-us/library/… –  John Chapman Dec 9 '11 at 17:53
    
Yes, I know but it is the server side, but how to prevent it on the client side. Simply hide the buttons. I have an idea to work with live() function in jquery and checking the values of current row - status is there, but that is quite tricky. –  christof Dec 9 '11 at 19:53
add comment

It would be much better UX IMO to prevent the delete by either removing all the delete buttons or disabling them. Telling the user that they can't delete something after a post back is generally considered annoying these days.

Using client side script means that your user can always hack the page, of course, and delete the item anyway. It all comes down to your business requirements.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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