You need to sign in to do that
Don't have an account?
CommandLink not working, refreshing the page.
I have a problem with my command link in the code below. Everytime I click on it just refreshes the page and does not go to the next page.
<apex:pageBlocktitle="Possible Personal Customer(s)"rendered="{!DisplayPosPersonalRecords == true && checkCustomer = 'No'}">
<apex:pageBlockTablevalue="{!ListPossiblePersonalRecords}"var="per"columnsWidth="5px, 5px"border="1">
<apex:columnheaderValue="Options">
<apex:commandLinkvalue="Selectd"style="font-weight:bold;"action="{!SubmitNewContactMoveToOpp}">
<apex:paramname="paccId"value="{!per.Id}"assignTo="{!SelectedId}"/>
<apex:paramname="paccType"value="Ppersonal"assignTo="{!SelectedType}"/>
</apex:commandLink>
</apex:column>
<apex:columnheaderValue="Customer Name"value="{!per.aName}"width="14.285%"/>
<apex:columnheaderValue="Equation No"value="{!per.EQ}"width="10%"/>
<apex:columnheaderValue="Email"value="{!per.Email}"width="14.285%"/>
<apex:columnheaderValue="Date of Bith"value="{!day(per.DoB)}/{!month(per.DoB)}/{!year(per.DoB)}"width="14.285%"/>
<apex:columnheaderValue="Address"value="{!per.Address}"width="14.285%"/>
<apex:columnheaderValue="Account Officer"value="{!per.AccountOfficer}"width="19.65%"/>
<apex:columnheaderValue="Created Date"value="{!per.CreDate}"width="14.285%"/>
</apex:pageBlockTable>
</apex:pageBlock>
I have even simplified my apex code so that it only returns the page and still no joy.
public PageReference SubmitNewContactMoveToOpp(){
return page.NewLoanOpp_Page_02;
}
Help...pulling my hair out!!
I found a solution to this and it was to do with my code in my Controller.
Here is my code: http://pastebin.com/hw1FYyhH post fix
In a nutshell my apex code in my controller was a bit messy even though it worked.
I believe for the Commandlink to work with a PageblockTable, the apex code should look like the example below:
----------------------------------------------------------------------------------------------
public List<accountset> getListPossiblePersonalRecords() {
accountlist = newList<accountset>();
List< Contact> Con = [selectId, Name, Email fromContact where email =: cemail
and LastName =: cLastName
and FirstName =: cFirstName];
for(Contactc:Con){
accountset thelist = newaccountset();
thelist.Id = c.Id;
thelist.aName = c.Name;
thelist.Email = c.Email;
accountlist.add(thelist);
}
returnaccountlist;
}
----------------------------------------------------------------------------------------------
I hope this helps. If there is a better way of explaining this or if anyone has any questions please feel free to reply.
Many thanks
All Answers
Perhaps you are getting some kind of validation error on the page which would have this effect. Try adding an <apex:messages> or apex:<pagemessages> to the top of your page to display any error messages....
I have <apex:Messages/> but dont have any error/validation messages. I have looked in the debug log and tried to find the action method and still nothing!!
Can you post your code? I have theory but cant test it as am away from eclipse, however if i am able to look at your code, I hopefully can find a pattern.
I found a solution to this and it was to do with my code in my Controller.
Here is my code: http://pastebin.com/hw1FYyhH post fix
In a nutshell my apex code in my controller was a bit messy even though it worked.
I believe for the Commandlink to work with a PageblockTable, the apex code should look like the example below:
----------------------------------------------------------------------------------------------
public List<accountset> getListPossiblePersonalRecords() {
accountlist = newList<accountset>();
List< Contact> Con = [selectId, Name, Email fromContact where email =: cemail
and LastName =: cLastName
and FirstName =: cFirstName];
for(Contactc:Con){
accountset thelist = newaccountset();
thelist.Id = c.Id;
thelist.aName = c.Name;
thelist.Email = c.Email;
accountlist.add(thelist);
}
returnaccountlist;
}
----------------------------------------------------------------------------------------------
I hope this helps. If there is a better way of explaining this or if anyone has any questions please feel free to reply.
Many thanks