apex HTML pass through not working


Pass through attribute doesn't generate proper html


HTML Pass through provided by salesforce in VF pages has been very useful when working with javascript libraries, However while working on the same I came across a situation where Pass through attribute doesn't get passed to generated html if the binding variable is 'Currency' type. Below is the example.



Controller

1:  public Opportunity Oppty {get;set;}   


VF page

1:  <apex:outputField value = '{!Oppty.Amount}' html-passedValue='XYZ'></apex:outputField>  

Generated html
1:  <span id="j_id0:j_id1:j_id14">$20</span>  



Hence you can see that the pass through attribute is not generated. However if you change the binding variable to any type other then Currency, pass through will start working. as shown below.




VF page

1:  <apex:outputField value = '{!Oppty.name}' html-passedValue='XYZ'></apex:outputField>  


Generated html

1:  <span id="j_id0:j_id1:j_id14" passedValue='XYZ'>john's opportunity</span>  



Hence conclusion is that whenever you bind CURRENCY type field to 'OutputField' element and try to pass 'html-*' attribute, it doesn't work.

Solution

I wrapped the outputField element with an outputPanel and provided the passthrough attribute to it and customized the Javascript accordingly.

I have also raised this issue with salesforce community here. let's hope if get the answer.

Comments

Popular posts from this blog

Use the System.enqueueJob Method to Specify a Delay in Scheduling Queueable Jobs

Secure Apex Code with User Mode Database Operations (Generally Available)

IsVisibleInSelfService on Task salesforce