Basic javascript functionality for adding,editing and deleting a record