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
mikumiku 

The button action issues

My VF have different status.which control what to render on the page, and the buttons on the page change the page status.

When I click the button on the VF,The controller did not trigger the action.But the VF page refresh to the initial status.

 

<apex:page standardController="APTable__c" extensions="CreateAPTable">
<apex:outputPanel style="color:red">
<apex:messages />
</apex:outputPanel>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
border-color: rgb(14,158,207);
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
width: 500px;
margin-left: -250px;
top:100px;
text-align:center;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}

</style>
<apex:form >
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!shouldpopup}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!shouldpopup}">
<apex:outputPanel layout="block">请选择连锁系统</apex:outputPanel>
<apex:outputPanel layout="block"><apex:outputText value="非NKA连锁系统"></apex:outputText>
<apex:selectList value="{!sLink1}" size="1">
<apex:selectOptions value="{!NKAoptions1}"/>
</apex:selectList></apex:outputPanel>
<apex:outputPanel layout="block"><apex:commandButton value="确定" action="{!closePopup}"/><apex:commandButton value="取消" action="{!popcancel}"></apex:commandButton></apex:outputPanel>
</apex:outputPanel>
<apex:pageBlock title="创建AP表第一步,选择客户" rendered="{!isstep1}">
<apex:pageBlockButtons >
<apex:commandButton action="{!step1}" value="下一步" rendered="{!hideprovince}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!apt.Account__c}">
<apex:actionSupport event="onchange" action="{!chooseaaccount}"/>
</apex:inputField>
<apex:pageBlockSectionItem rendered="{!hideprovince}">
<apex:outputText value="省区"></apex:outputText>
<apex:selectList value="{!pId}" size="1" >
<apex:actionSupport event="onchange" action="{!chooseprovince}"/>
<apex:selectOptions value="{!poptions}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!hideprovince}">
<apex:outputText value="城市"></apex:outputText>
<apex:selectList value="{!cid}" size="1" disabled="{!NOT(control1)}">
<apex:selectOptions value="{!cityoptions}"/>
</apex:selectList>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem rendered="{!hideprovince}">
<apex:outputText value="NKA/非NKA" ></apex:outputText>
<apex:selectList value="{!sNKA}" size="1">
<apex:selectOptions value="{!NKAoptions}"/>
</apex:selectList>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem rendered="{!hideprovince}">
<apex:outputText value="连锁系统"></apex:outputText>
<apex:selectList value="{!sLink}" size="1">
<apex:selectOptions value="{!Linkoptions}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock title="创建AP表第二步,选择门店" rendered="{!isstep2}">
<apex:pageBlockButtons >
<apex:commandButton action="{!prestep}" value="上一步" />
<apex:commandButton action="{!step2}" value="下一步" />
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputText value="门店"></apex:outputText>
<apex:selectList value="{!sId}" size="1">
<apex:selectOptions value="{!soptions}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<!--<apex:inputField value="{!tempobj.Store__c}"></apex:inputField>-->
<apex:pageBlockSectionItem >
<apex:commandButton value="添加" action="{!addcity}"></apex:commandButton>
<apex:commandButton value="添加所有门店" action="{!addAll}"></apex:commandButton>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!apsts}" var="o" rendered="{!tcount}">
<apex:column width="10%"><apex:commandLink value="删除" action="{!itemdelete}">
<apex:param name="objid" value="{!o.Store__c}"/></apex:commandLink></apex:column>
<apex:column value="{!o.Store__c}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>

<apex:pageBlock id="page" title="创建AP表第三步,输入详细信息" rendered="{!isstep3}">
<apex:pageBlockButtons >
<apex:commandButton action="{!onSave}" value="确定"/>
<apex:commandButton action="{!onCancel}" value="退出"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="请输入数据" id="inputdata">
<apex:inputField value="{!apt.StoreDescription__c}"></apex:inputField>
<apex:inputField value="{!apt.StoreQuantity__c}"></apex:inputField>
<apex:inputField value="{!apt.APBrand__c}"></apex:inputField>
<apex:inputField value="{!apt.Campaigns__c}" >
<apex:actionSupport event="onchange" action="{!campaignchanged}" rerender="page"/>
</apex:inputField>
<apex:inputField value="{!apt.AccountType__c}" >
<apex:actionSupport event="onclick" action="{!accounttypeprotect}"/>
</apex:inputField>
<apex:inputField value="{!apt.CostType__c}" >
<apex:actionSupport event="onchange" action="{!CostTypechanged}"/>
</apex:inputField>
<apex:inputField value="{!apt.DetailCostType__c}" >
<apex:actionSupport event="onchange" action="{!DetailCostChanged}" />
</apex:inputField>
<apex:inputField value="{!apt.TFItype__c}" rendered="{!isTFI}">
</apex:inputField>
<apex:inputField value="{!apt.Payment__c}"></apex:inputField>
<apex:inputField value="{!apt.ReceivablesObject__c}"/>
<apex:inputField value="{!apt.ReceivablesObjectName__c}"/>
<apex:inputField value="{!apt.Applicant__c}"/>
<apex:inputField value="{!apt.beginDate__c}"/>
<apex:inputField value="{!apt.endDate__c}"/>
<apex:outputField value="{!apt.Retail_Customers__c}" rendered="{!showNKA}"/>
<apex:outputField value="{!apt.NKA__c}" rendered="{!showNKA}"/>
<apex:pageBlockSectionItem rendered="{!showNKA}" >
<apex:outputText value="费用归属"></apex:outputText>
<apex:selectList value="{!apt.BudgetSource__c}" size="1">
<apex:selectOptions value="{!bsoptions}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:inputField value="{!apt.Remarks__c}"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection title="产品相关费用明细" rendered="{!productrelated}">
<apex:inputField value="{!apt.Product__c}"/>
<apex:inputField value="{!apt.StandardPrice__c}"/>
<apex:inputField value="{!apt.PromotionPrice__c}"/>
<apex:inputField value="{!apt.StoreStandardPrice__c}"/>
<apex:inputField value="{!apt.StorePromotionPrice__c}"/>
<apex:inputField value="{!apt.PromotionProdcutNumber__c}"/>
<apex:inputField value="{!apt.PromotionPriceAdd__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="临促工资费用明细" rendered="{!promotion}">
<apex:inputField value="{!apt.PromotionSalary__c}"/>
<apex:inputField value="{!apt.PromoterNumber__c}"/>
<apex:inputField value="{!apt.PromotionDay__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="费用明细" rendered="{!othercost}">
<apex:inputField value="{!apt.FeeDescription__c}"/>
<apex:inputField value="{!apt.applicationamount__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="campaigninfo" title="市场活动信息" rendered="{!campaignisfilled}">
<apex:outputField value="{!apt.CampaignType__c}"/>
<apex:outputField value="{!apt.CampaignItem__c}"/>
<!-- <apex:outputField value="{!apt.CampaignCode__c}"/>-->
<apex:outputField value="{!apt.CampaignDescription__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>


<apex:pageBlock rendered="{!checkVal}">
<apex:pageBlockTable value="{!apts}" var="o">
<apex:column headervalue="AP表号"><apex:outputLink value="/{!o.id}">{!o.Name}</apex:outputLink></apex:column>
<apex:column headervalue="活动" value="{!o.Campaigns__c}"></apex:column>
<apex:column headervalue="金额" value="{!o.Total__c}"></apex:column>
<apex:column headervalue="客户类型" value="{!o.AccountType__c}"></apex:column>
<apex:column headervalue="费用大类" value="{!o.CostType__c}"></apex:column>
<apex:column headervalue="费用小类" value="{!o.DetailCostType__c}"></apex:column>
<apex:column headervalue="需交核销凭证" value="{!o.writeoffverification__c}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

any suggestion would be thanked

Best Answer chosen by Admin (Salesforce Developers) 
mast0rmast0r

Try to reRender your form:

 

<apex:form id="myForm">

    ...

    <apex:commandButton action="{!onSave}" value="Your cool label ;)" reRender="myForm"/>

    ...

</apex:form>

 

All Answers

mast0rmast0r

Try to reRender your form:

 

<apex:form id="myForm">

    ...

    <apex:commandButton action="{!onSave}" value="Your cool label ;)" reRender="myForm"/>

    ...

</apex:form>

 

This was selected as the best answer
mikumiku

Thanks! the issue is fixed.