You need to sign in to do that
Don't have an account?
Not possible to pass dynamic variable into javascript at commandLink oncomplete
I'm want to pass a dynamically set variable "f" which serves as an element id into a javascript to be able to recolor the item.
However, I get the following error at compile time:
Save error: Unknown property 'OpportunityStandardController.f'
Is this a limitation or have I misunderstood anything?
<apex:repeat var="f" value="{!families}">
<li>
<span>
<apex:commandLink value=""
action="{!runSearch}"
rerender="results,debug"
oncomplete="doIt({!f});">
<apex:param name="name" value="" />
<apex:param name="onlySellable" value="" />
<apex:param name="family" value="{!f}" />
<span id="{!f}" name="nameAllItems">{!f}</span>
</apex:commandLink>
</span>
</li>
</apex:repeat>
<script>
function doIt(string anId){
var items = document.getElementsByName("nameAllItems");
for(var i = 0; i < items.length; i++)
{
items[i].setAttribute("class", "");
}
document.getElementById(anId).setAttribute("class", "current");
}
</script>