Obviously, your door lock should not come off...
does the horn blow just once or like three times really fast? Does it lock the doors with the fob? Sounds like you may have a bad actuator.
what about locking it with the key? Does that work?
Your car, to prevent you from locking your self out, will not lock the doors if one (or both) is open. If you try, it will beep rapidly three times in a row and not lock your doors. To fix it, you have to close your doors, unlock the car (I know, it's not locked) then lock it.