You need to sign in to do that
Don't have an account?
JJSHHS
Command button/Re-render not working inside pageblock table
Hello,
I'm trying to seek some help with the following VF page and the controller behind it, Basically, the outline of this controller is 3 pages...page 1 to capture account info, page 2 to capture multiple contacts for this acct and page 3 to just show the confirmation page....and give users the option to delete the contacts one by one by with a command button.
Now, neither the OnClick action is working, nor is the method getting invoked (I'm unable to see the "inside deleteCont" message in the debug logs) and the re-rerender is not working too...Please advise on what is it I'm missing.
I'm trying to seek some help with the following VF page and the controller behind it, Basically, the outline of this controller is 3 pages...page 1 to capture account info, page 2 to capture multiple contacts for this acct and page 3 to just show the confirmation page....and give users the option to delete the contacts one by one by with a command button.
Now, neither the OnClick action is working, nor is the method getting invoked (I'm unable to see the "inside deleteCont" message in the debug logs) and the re-rerender is not working too...Please advise on what is it I'm missing.
public class newOpportunityController { public Account acct {get;set;} public contact cont {get;set;} public Listcontactstoadd{get;set;} private static final integer maxContacts=5; public Integer rowIndex {get;set;} public pagereference page3; public newOpportunityController() { if(acct == null) {acct = new Account();} if(cont == null) {cont = new Contact();} if (contactstoadd == null) {contactstoadd = new list();} } public pagereference deleteCont() { system.debug('inside deleteCont'); rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex')); System.debug('row to be deleted ' + rowIndex ); System.debug('rowm to be deleted '+Contactstoadd[rowIndex]); contactstoadd.remove(rowIndex); return page3; } }
did you tried with actionfunction to call controller method ?
I think the problem is with the following line of code
rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
Are you using apex:param () or passing rowIndex through the url?
If you are using apex:param you won't be able to get the value of rowIndex using ApexPages.currentPage().getParameters().get('rowIndex').
If you can post the VF page I can help you with the solution.
Regards,
Krishna.
Hi Balaji,
It seems like there is some issue with vf page code, even I am not able to paste vf page. Recently there were spam attack on forum so perhaps SFDC has disabled it for some time.
I actually modeled my code based on this link...but this one doesn't seem to have Outputpanel, nor the actionfunction...Also, when I looked at actionfunction example, I don't think that's what I needed....Please advise.
https://prats23.wordpress.com/2014/04/27/salesforce-dynamically-addingdeleting-rows-in-visualforce/
I'm unable to paste the VF page here and it's a pain...Yes, I'm passing the rownumber value failing which the code wouldn't compile =)
I tried the option of using OutputPanel and putting the pageblock table inside the Output panel and it would still not work...any thoughts?
Why don't you pass the Id field in the apex:param instead of rowNumber.
And in the controller create a public variable as below.
public string conId {get; set;}
and use this field in the deleteCont method to delete the corresponding contact.
Regards,
Krishna.
The issue is that this is the confirmation page before the save to db. Hence, the contacts don't have an ID yet to pass. Hence, the need to pass rownumber.