+ Start a Discussion
SSRS2SSRS2 

Html input checkbox render problem

If use

 

<input type="checkbox" value="Bike" checked="{IF(false,'checked' ,'')}"/>

Always checkbox is checked. But it should be unchecked

 

 If use

 

<input type="checkbox" value="Bike" checked=""/>

 Checkbox is unchecked

 

  What is the different of

    checked="{IF(false, ‘checked' ,'')}" & checked=""

 

How I toggle checked state dynamically with a custom condition ?.

(Salesforce.com API  VF page version is 19.0)

 

-Suresh

bob_buzzardbob_buzzard

Use the following:

 

 

   <input type="checkbox" value="Bike" {!IF(false,'checked' ,'')}/>

I think the browser expects the string "checked" rather than a property name checked.  This will rendered 'checked' if the condition evaluates to true.

 

SSRS2SSRS2

Dear Bob

  I checked your code stuff.

  But it is not save with  Salesforce.com API  VF page version is 19.0

  I think your API version is bellow 19.0

  It gives a compile error

 

  Error: Element type "input" must be followed by either attribute specifications, ">" or "/>".

 

  thanks

 -Suresh

 

splitsplit
SSRS2SSRS2

Following code rendered with selected

 

 

<apex:inputCheckbox value="{!Opportunity.isprivate}" selected="true" />

 But following rendered without selected

 

 

<apex:inputCheckbox value="{!Opportunity.isprivate}" selected="{!IF(true, true, false)}" />

 

 

How to change dynamically selected state ?