Solving record locking is far from simple in web applications. See the following SO question for a brief outline of the problem:
http://stackoverflow.com/questions/3358957/blocking-a-record-from-editing-while-another-user-is-editing-the-record-how
Unlike in client-server applications you can only choose from workarounds. The closer you need to get to the client-server model the more work is required.
I would probably not try to lock it but just warn that someone else is editing the record and save all modifications in version history. This way users will be able to resolve the conflict manually without losing the data.