You need to sign in to do that
Don't have an account?

apex:variable bug?
Hi All,
Perhaps I'm being stupid but this one seems like a bug to me. There is a little too much code to paste everything here so I'll explain.
I have a controller (TMDR_ShoppingCart) which instantiates and loads up an instance of class I've written (TMDR_RateCard Ratecard).
TMDR_ShoppingCart has a method TMDR_RateCard getRateCard();
TMDR_Ratecard has a method List<Product2> getProducts();
All fine and all working so far.
Here is the snippet of my page:
<apex:commandLink action="{!addItem}" value="{!p.name}" id="addProductLink" > <apex:param name="productID" value="{!p.ID}"/> </apex:commandLink> </apex:column> </apex:pageBlockTable>
This code successfully renders a table with a list of product names. However, clicking on the link simply rerenders the page. The call to addItem() never happens (plenty of debug showed me that).
Now, if I get rid of the var and call it directly instead like so:
<apex:pageBlockTable value="{!RateCard.ProductsAsList}" var="p" id="table"> <apex:column style="font-weight:bold" width="320px" headerValue="Name"> <apex:commandLink action="{!addItem}" value="{!p.name}" id="addProductLink" > <apex:param name="productID" value="{!p.ID}"/> </apex:commandLink> </apex:column> </apex:pageBlockTable>
Page renders just as before, but now the links work.
An inspection of the rendered link shows that the code is identical for both versions
<a id="j_id0:j_id1:products:j_id2:table:0:addProductLink" href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:products:j_id2:table:0:addProductLink,j_id0:j_id1:products:j_id2:table:0:addProductLink,productID,01t20000000Fa4WAAS','');}return false">Basic Job</a>
And a quick edit on the fly shows that (typeof jsfcljs == 'function) is true in both instances.
Obvious solution is not to use the var I know , but I was actually loading it up earlier in the page to call other methods. (I've slimmed the page down massively to debug)
So, is this a bug?
TIA