7

I have a custom Visualforce page that includes a dynamically sized table. The first column in the table is a Lookup to Account. When that value is chosen, some logic is run to populate some of the subsequent columns in that row.

A user has noticed that when typing in the lookup, sometimes the "My Recent Items" dropdown freezes in place. The rest of the form remains usable, but that hover frame just stays in place. I was able to reproduce it by clicking on the header "My Recent Items" rather than a value.

enter image description here

The above picture is 2 lookup "recent items" after I removed the rows on the Visualforce page (they don't go away). The user apparently triggered this some other way, where he was able to get rid of them when the lookup was removed from the screen. It seems to happen for me whether I have just one item in the recent items, or a list of them.

I'm currently thinking that this has to do with the fact that this lookup drives a refresh of the page, because I have some other Visualforce pages with similar implementations that don't seem to have the same issue (but also don't autorefresh other columns in the row based on the lookup). Curious if anyone else has experienced this. Code for this column in the pageBlockTable is below.

<apex:column headerValue="Account" width="60px">
  <apex:variable var="incomeNum1" value="{!incomeNum1 + 1}"/>
  <apex:inputField value="{!t.Account__c}" required="false">
    <apex:actionSupport event="onchange" rerender="incomeBlock">
      <apex:param name="depositIndex" assignTo="{!depositIndex}" value="{!incomeNum1}"/>
    </apex:actionSupport>
  </apex:inputField>
</apex:column>

In this example, "incomeBlock" refers to the PageBlock that encapsulates a PageBlockSection, and the PageBlockTable is within that. I also use some different apex variables/params to keep track of row indices for add/remove.

EDIT (3/12/13): I also tried changing actionSupport to actionFunction based on this post but got the same results.

<apex:column headerValue="Account" width="60px">
  <apex:variable var="incomeNum1" value="{!incomeNum1 + 1}"/>
  <apex:inputField value="{!t.Account__c}" required="false" onchange="actionChosen()">
  </apex:inputField>
  <apex:actionFunction name="actionChosen" reRender="incomeBlock">
    <apex:param name="depositIndex" assignTo="{!depositIndex}" value="{!incomeNum1}"/>
  </apex:actionFunction>
</apex:column>

EDIT (3/13/13): I replicated it in a smaller subset of code referred to in these 2 gists. If you load those up (and have some recent items), type in the first letter of an Account and then click on the My Recent Items a few times (I don't think this is what users are doing...but it is how I am replicating). Then if you change the "onchange" to "onselect", it works fine, but the implicit autocompletion on blur stops working.

https://gist.github.com/mwelburn/5154735

https://gist.github.com/mwelburn/5154741

6
  • Hm never seen this. What browser/OS? Have you replicated this in the major browsers?
    – jkraybill
    Mar 12, 2013 at 23:51
  • I am personally using Chrome for what I described above. It doesn't happen for a lookup that sits alone, it seems to have something to do with driving a refresh. I'm spending some more time on it today so I'll report back any findings. Mar 13, 2013 at 12:37
  • Also seeing it in Safari (both of these on a Mac) Mar 13, 2013 at 14:20
  • Hm if so, this looks like a straight UI bug. There will likely be some way to work around it using some hackish JS, but you should also file a case on it.
    – jkraybill
    Mar 14, 2013 at 2:05
  • Just filed a case -- will update if I find anything out. Mar 14, 2013 at 14:44

1 Answer 1

1

You can use onsubmit attribut in apex:actionSupport to fix this problem by JavaScript

2
  • 3
    Can you provide a code snippet that shows how it works? Mar 13, 2013 at 10:05
  • I think this works if I am always using the lookup popover. It seems like the issue is that if I click the header enough, it seems to "chose" the first option in the list and resolve the lookup, but the popover doesn't realize it. Unfortunately this doesn't help with a user trying to just type in a partial name, tab over, and have the lookup resolve. Mar 13, 2013 at 17:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .