You need to sign in to do that
Don't have an account?
Selected TabIssue + common.formula.FormulaParseException: Syntax error + action in commandButton
Am Facing an VisualForce Error
" common.formula.FormulaParseException: Syntax error. Found 'if' "
When I click the New CutomObject Button am getting this Error..... it is due to the value="{!if(ActiveTab != null, ActiveTab, 'tab1')}" attribute of my <apex:TabPanel>
check
<apex:tabPanel switchType="client" id="tabpanel" value="{!if(ActiveTab != null, ActiveTab, 'tab1')}" >
Which is not allowing to redirect to New record page , when is use a Fomula in Action attribute
<apex:commandButton value="New PortofOrigin" action="{!URLFOR($Action.Port_of_Origin__c.New)}"> OR Even directly with URL link
<apex:commandButton value="New PortofOrigin" action="https://cs5.salesforce.com/a0R/e?retURL=%2Fa0R%2Fo" >
My Visualforce Page:
<apex:page showHeader="false" id="thePage" controller="extensionController1"> <script> function setCookie(c_name,value) { var exdate=new Date(); exdate.setDate(exdate.getDate() + 99); var c_value=(escape(value) + : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } </script> <apex:form id="form"> <apex:actionFunction name="setTab" onComplete="return false;" rerender="tabpanel"> <apex:param name="activeTab" assignTo="{!ActiveTab}" value="" /> </apex:actionFunction> <apex:tabPanel switchType="client" id="tabpanel" value="{!if(ActiveTab != null, ActiveTab, 'tab1')}" tabClass="activeTab" inactiveTabClass="inactiveTab" > <!-- TAB ONE STARTS --> <apex:tab title="tab1" label="tab1" id="object1" name="tab1" ontabenter="setCookie('apex__counter','tab1');" switchType="client"> <apex:message title="Error"/> <apex:pageBlock title="tab1" mode="edit" tabStyle="Sourcing__tab"> <!-- NEW BUTTON WHICH WHEN CLIKCED FOR --> <apex:pageBlockButtons location="top" style="padding-left:70px;"> <apex:commandButton value="New CustomObject1" action="{!URLFOR($Action.CustomObject1__c.New)}" style="font-size:12px;font-weight:bold;width:120px;"/> </apex:pageBlockButtons> </apex:pageblock> </apex:tab> <!-- TAB TWO STARTS --> <apex:tab title="tab2" label="tab2" id="object2" name="tab2" ontabenter="setCookie('apex__counter','tab2');" switchType="client"> <apex:message title="Error"/> <apex:pageBlock title="tab1" mode="edit" tabStyle="Sourcing__tab"> <!-- NEW BUTTON WHICH WHEN CLIKCED FOR --> <apex:pageBlockButtons location="top" style="padding-left:70px;"> <apex:commandButton value="New CustomObject2" action="{!URLFOR($Action.CustomObject2__c.New)}" style="font-size:12px;font-weight:bold;width:120px;"/> </apex:pageBlockButtons> </apex:pageblock> </apex:tab> </apex:tabpanel> </apex:form> </apex:page>
The Controller is:
public with sharing class extensionController1 { public string ActiveTab { get; set; } public extensionController1() { Cookie counter = ApexPages.currentPage().getCookies().get('counter'); // If this is the first time the user is accessing the page, // create a new cookie with name 'counter', an initial value of '1', // path 'null', maxAge '-1', and isSecure 'false'. if (counter ==null) { counter = new Cookie('counter','tab1',null,999,false); // Set the new cookie for the page ApexPages.currentPage().setCookies(new Cookie[]{counter}); } else { // If this isn't the first time the user is accessing the page // create a new cookie, incrementing the value of the original count by 1 ActiveTab = String.valueOf(counter.getValue()); } system.debug('@@ActiveTab: ' + ActiveTab); } }
Please provide a Solution to this,Such that I can use the last selected tab Functionality and create new records from the tabpanel.
-Thank you
the ActionFunction setTab is not being called anywhere? Does it need to be called or no?
And is there more to your apex controller, page? because I tested it and it seems to be working fine. What browser are you using for testing?