function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VinslikeuVinslikeu 

Page get reload after selecting picklist value and switches to home tab

Hi,

In the following code when i select picklist value in purchase order tab; page gets reload and switches to home tab.

Please help me to stay on the same tab.

 

 

///////////////////////Visualforce/////////////////////

<apex:tabPanel switchType="client" selectedTab="Home" id="SOTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">

<apex:tab label="Home" name="Home" id="tabHome">
<apex:form >
<apex:pageBlock title="Hello {!Name}!!! Welcome To UltraVoilet" >
</apex:pageBlock>
</apex:form>
</apex:tab>

 

<apex:tab label="Purchase Order" name="PO" id="tabPO">
<apex:form >
<apex:pageBlock title="Purchase Order Creation" mode="Edit" >
<apex:pageBlockSection title="Header" columns="4">
<b>State:</b>
<apex:selectList size="1" value="{!SelectedValue}">
<apex:selectOptions value="{!statusOptions}"/>
<apex:actionSupport event="onchange" action="{!checkValue}" />
</apex:selectList>
</apex:pageBlockSection>

</apex:pageBlock>

 </apex:form >

</apex:tab>

 

 

 

//////////////Controller///////////////
public string selectedValue { get;set; }
public List<SelectOption> statusOptions { get;set; }

public void autoRun()
{
Schema.DescribeFieldResult statusFieldDescription = UV_Account__c.State__c.getDescribe();
statusOptions = new list<SelectOption>();

for (Schema.Picklistentry picklistEntry : statusFieldDescription.getPicklistValues())
{
statusOptions.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));
}

}

public void checkValue()
{
System.debug('----------------'+selectedValue);
}

ezdhanhussainezdhanhussain

add rerender attribute in your action support.

<apex:actionSupport event="onchange" action="{!checkValue}" rerender="tabPO" />

 

 

if solved mark it as splution