You need to sign in to do that
Don't have an account?
Ritesh__
Unknown function addElement. Check spelling apex salesforce
i created a visualforce page in which there is a code segment
<apex:column ><apex:commandButton value="{!if(item.i == size-1,'Add','Delete')}" action="{!if(size == 1,addElement(),removeElement())}"></apex:commandButton></apex:column>
i created a custom controller containing function
public PageReference addElement(){ return null; } public PageReference removeElement(){ return null; }
but when i try to save the visualforce page it is giving me error
Error: Unknown function addElement. Check spelling
can any one please tell me how to use if structure in action attribute so that it will properly work
Apparently, you can't use if statements in action attributes (I tried this in my dev org).
Instead, you can either: (1) use two command buttons, and render only the option that's currently available via the rendered attribute, or (2) have the command button call a common function that in turn calls the appropriate action.
Ex 1:
Ex 2:
Where actioncommand is simply a function that calls one or the other function depending on the condition.