You need to sign in to do that
Don't have an account?
Abu Zafar Wahid
How to add/bind checkbox value in wrapper class
Hi everyone,
Recentetly I've added a form page where user can add much as rows as he wants. All of the input fields keep the previous row data in the form except the checkbox.
FYI, the checkbox does not belong to any standard or custom object, it is just a checkpoint for checking if certain input field checked or not.
I tried to declare the checkbox as List<Boolean> but same issue. Please advise.
Thanks
Recentetly I've added a form page where user can add much as rows as he wants. All of the input fields keep the previous row data in the form except the checkbox.
FYI, the checkbox does not belong to any standard or custom object, it is just a checkpoint for checking if certain input field checked or not.
I tried to declare the checkbox as List<Boolean> but same issue. Please advise.
Thanks
When you clicks on "Add Row", it's not binding the existing selected one. Correct?
I have ran your code in my dev org and its working as expected apart from above issue.
If this is only an issue, Please remove "Immediate = true" attribute from "Add Row" button, it will not allow your data to bind your controller
All Answers
Please post your current code here and will provide the solution on top of it.
You just need to use the public Boolean isSelected {get; set;} in the wrapper class.
Regards,
Mahesh
Hi Mahesh,
Thanks for your quick response, please see below:
Please see below code for example
Visualfore Page:
Controller:
Thanks,
Prem Anandh
Hi Prem,
Thank you, my scenerio is slightly different, I'm using your example and rearrange them according my situation
The problem is happening when trying to add a new row, then found that the previous checkboxes are uncheked. Which is because the the value of these fields are not binded in the wrapper.Prem,
No bro it's not helping me yet, let me post my refiened code snippet so that you can guide me to the right way:
When you clicks on "Add Row", it's not binding the existing selected one. Correct?
I have ran your code in my dev org and its working as expected apart from above issue.
If this is only an issue, Please remove "Immediate = true" attribute from "Add Row" button, it will not allow your data to bind your controller
Prem you're right! This was the root cause.
Thanks so much.