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
Erik RodgersErik Rodgers 

dynamically selected apex:inputCheckbox from an expression visualforce

I have a visualforce page with a pageBlockTable. I would like one of the columns to be a dynamically selected (checked or unchecked) apex:inputCheckbox driven by a String value from my object array. Here is the line I am using: 

<apex:inputCheckbox selected="{!IF(orderHeaderData.has_order_hold == 'Y',true,false)}" disabled="true" />

I am getting the following error:
Syntax error. Missing ')'

I am not able to use a true boolean, so I am trying to use an expression to return a boolean based on my String value. I would appreciate any help with why this won't work.

Thanks.
ManojjenaManojjena
Hi Erik,

Please try with below it will work .
<apex:inputCheckbox selected="{!IF((orderHeaderData.has_order_hold == 'Y'),true,false)}" disabled="true" />

Thanks
Manoj
Mudasir WaniMudasir Wani
Hi Erik,

I tried your code and it is giving me the same error.
The work around for this is to create a formulae field say "CheckBoxVal__c" and use the logic there and on the page use the following code
 
<apex:inputCheckbox selected="{!ObjectInstance__c.CheckBoxVal__c}" disabled="true" />



Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help

 
Erik RodgersErik Rodgers
Mudasir, Thank you for your reply, but all data is coming from a real-time web service call to our Oracle ERP system. There are no sObjects involved.
Mudasir WaniMudasir Wani
You need to handle it in apex.
How you are parsing the data from wen services.
Have you created any apex structure or wrapper.
if you have any of these then add anothe property there and set it as per your data.
Then use that property on the page.

 
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
 
Erik RodgersErik Rodgers
It is an auto-generated and highly nested structure. I would have to loop through arrays of arrays to set this. I find it odd that something so basic is so complicated to accomplish using Visualforce expressions.
Erik RodgersErik Rodgers
Manoj, I receive the exact same error