I need to add some JS to some salesforce standard edit pages to allow us to add functionality to aid in data entry.
I would like to do it the "correct" way and my salesforce knowledge isn't great. I have however read all I can find and established that up to recently (last few days?) you could add a widget to the sidebar that would inject JS onto every page or edit pages etc but this seems very hacky and as I mentioned seems to have been disabled now.
The option that seems to be the best and most supported is to add a new VisualForce page and that uses the standardController for the page you want (for example "Contact") then include the default page for example:
<apex:page standardController="Contact">
<apex:detail inlineEdit="true" />
</apex:page>
and then throw in the JS to do the work or maybe some kind of include of the JS resource? like:
<apex:includeScript value="{!$Resource.example_js}"/>
Now a few quick tests using something like:
<apex:page standardController="Contact">
<apex:detail inlineEdit="true" />
<script type="text/javascript" language="Javascript">
alert('Do stuff here...');
</script>
</apex:page>
Which appears to work fine for the in-line edit option but I really want to use it for both the main edit page and the new page (might be the same). This is where I have hit a brick wall as I can't find out how to build a page the "inherits" the standard edit/new page.
I don't want to be creating custom pages as this would mean that any already configured custom fields wouldn't be there and would make adding/removing fields require the VisualForce page to be updated (not the easy drag and drop of the standard page editor!)
So to conclude: I want to add custom JS to a lot (all if easier?) new/edit forms the "right" way. I don't mind creating custom VisualForce pages for each of the edit pages BUT the new pages MUST just have the same layout etc as the original pages and update when they do. :) I'm SURE that's not to much to ask? ;)
Thanks
P.S. Please assume I have no knowledge of salesforce and point me to any info required for the solution as I really only started using salesforce Monday! ;)