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
ChickenOrBeefChickenOrBeef 

VisualForce's "inputField" redirects user when it shouldn't

Hey everyone,

I have a VisualForce page embedded within our standard Opportunity layout. Up until now this VF page has just been a table with custom checkbox fields using "inputCheckbox". When a user went to an Opportunity the page would open as normal at the top of the Opportunity page.

However, I've since added an "inputField" to the VF page, which allows the user to fill in one of our existing Lookup fields. The problem is that whenever the user goes to an Opportunity now, the Opportunity will open and then the user is directed down to the VF page instead of staying at the top of the Opportunity.

Is there a reason why the "inputField" parameter causes the screen to immediately redirect down to the VF page?

Thanks,
Greg
Best Answer chosen by ChickenOrBeef
ChickenOrBeefChickenOrBeef
So it turns out I was onto something. I put the inputField within a section that's collapsed by default and now the redirect doesn't happen.

See this thread for how to do it:

http://salesforce.stackexchange.com/questions/87925/how-to-make-a-pageblocksection-collapsible-when-click

-Greg

All Answers

Morgan MarcheseMorgan Marchese
Without seeing any code its hard to speculate but my first guess is that, since your Opportunity is in READ mode, but your field on the inline VF page is an INPUT field, your browsers default behavior is causing cursor focus to fall into that (first) input field upon load, resulting in the browser window shifting down to show you where your cursor is at (similar results would likely occur if you scrolled to the top, put your cursor in the Global Search, and then pressed Tab a few times)
ChickenOrBeefChickenOrBeef
That definitely makes sense. Is there a simple way to fix something like that? Perhaps if I put the inputField in a section that's collapsed by default?

Thanks,
Greg
ChickenOrBeefChickenOrBeef
So it turns out I was onto something. I put the inputField within a section that's collapsed by default and now the redirect doesn't happen.

See this thread for how to do it:

http://salesforce.stackexchange.com/questions/87925/how-to-make-a-pageblocksection-collapsible-when-click

-Greg
This was selected as the best answer
Morgan MarcheseMorgan Marchese
Hey Greg,

Glad to see you worked it out for yourself, sorry I hadn't replied - I didn't receive an email notification so I wasn't aware that you had left a follow-up question.

Regardless, nicely done :)