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
morleymorley 

onClick event failing

Hi there ... this one is baffling me. I have onClick events defined in two places, but only one will work. When I click on a record from the first table (Account Types), the onClick works fine. But if I click on a record from the second table (Accounts), the event doesn't fire. Why??

PAGE:
<apex:page controller="commsActivity" id="thePage">

<apex:pageBlock>
<apex:outputPanel id="myAccountTypes">
<apex:form>
<apex:dataTable value="{!account_types}" var="thisAccountType" id="theAccountTypeTable" styleClass="tableClass">
<apex:column>
<apex:outputPanel>
<apex:actionSupport event="onclick" reRender="myAccounts">
<apex:param name="accType" value="{!thisAccountType.Name}"/>
</apex:actionSupport>
{!thisAccountType.Name}
</apex:outputPanel>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:outputPanel>
</apex:pageBlock>

<apex:pageBlock>
<apex:outputPanel id="myAccounts">
<apex:form>
<apex:dataTable value="{!accounts}" var="thisAccount" id="theAccountTable" styleClass="tableClass">
<apex:column>
<apex:outputPanel>
<apex:actionSupport event="onclick" reRender="myContacts">
<apex:param name="accID" value="{!thisAccount.ID}"/>
</apex:actionSupport>
{!thisAccount.name}
</apex:outputPanel>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:outputPanel>
</apex:pageBlock>

<apex:pageBlock>
<apex:outputPanel id="myContacts">
<apex:dataTable value="{!contacts}" var="thisContact" id="theContactTable" styleClass="tableClass">
<apex:column>
{!thisContact.name}
</apex:column>
</apex:dataTable>
</apex:outputPanel>
</apex:pageBlock>

</apex:page>

 
CONTROLLER:

public class commsActivity{

public List<System.Account_Type__c> getAccount_Types() {
return [select name from account_type__c];
}

public List<System.Account> getAccounts() {
return [select id, name, Account_Type__c, description from account where Account_Type__c =:System.currentPageReference().getParameters().get('accType')];
}

public List<System.Contact> getContacts() {
return [select id, name, email from contact where Accountid =:System.currentPageReference().getParameters().get('accID')];
}

}

 

 

Ron HessRon Hess
try using just one form for the entire page, rather than two seperate forms, that should help.

morleymorley
I just gave that a try now and unfortunately there's no change. Bummer. Any other ideas?
Ron HessRon Hess
This appears to be working on Winter08, are you on NA1? can you try this again?
thanks.
morleymorley
Hi Ron ... that's good news. We're on NA2, which I believe is moving to Winter 08 this weekend, so I'll try it after that. Thanks a lot for your help.



Glenn.