function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
cmarkcmark 

code on edit screen

i found an interesting piece of code recently.  through the use of a couple of HTML Snippet SControls, a custom lookup button was added beside a field on an Edit page.  what's the trick?  where do i put what so that the javascript is written into the Edit page?
thanks
chris
werewolfwerewolf
The trick is to put it in a sidebar Scontrol, since those are the only Scontrols that are run in edit mode.  Still very much a hack.  Use Visualforce instead if you can.
tinman44tinman44
Werewolf-
 
Intersted in learning about the hack you described...
 
--
The trick is to put it in a sidebar Scontrol, since those are the only Scontrols that are run in edit mode.  Still very much a hack.  Use Visualforce instead if you can.
--
 
What do you mean by sidebar scontrol? I do a ton of dev work and cannot place what you mean by this.
 
Thanks!
werewolfwerewolf
It's an Scontrol that resides as a component on the sidebar.  Basically, you make an Scontrol, add it as a Left/Narrow Home Page Component, then go to Setup->Customize->User Interface and turn on Show Custom Sidebar Components on All Pages.  Then it will show up on all pages, even edit pages.  You can make your Scontrol clever enough to figure out that it's an edit page by parsing out the /e in the URL, and then do stuff with it.

That said:

You're really better off doing this with Visualforce if you can.  I'm not kidding.
tinman44tinman44
Werewolf-
 
Thanks for the reply. I agree on the Visualforce...it was just the curious developer in me wanting to learn a new trick.
 
Thanks!
TristanTristan
I know this isn't the VisualForce forum, but could you say just how you'd go about doing the same thing (customising edit screens) using your recommended VF?

Thanks!

Tristan.
mtbclimbermtbclimber
Check out page 22 in the visualforce developer guide for a sample account edit page.