You need to keep in mind that on the Form tab the current page/document context is not available. There are some values in the frame's URL in the query string which are identifying the object to be edited. So, you need to work with EditedObject as described e.g. in this post or this post.