2013-03-12 2 views
-1

я уверен, что я делаю очень маленький mistake.i создал страницу Visualforce с кодомзасавить не работает, как ожидалось в Visualforce

<apex:page standardController="RuleCriteria__c" extensions="AW_RuleCriteriaController3"> 
<apex:form > 
<apex:pageBlock title="Rule Criteria Detail"> 
     <apex:pageBlockButtons > 
      <apex:commandButton value="Save" /> 
      <apex:commandButton value="Save and New" /> 
      <apex:commandButton value="Cancel" /> 
     </apex:pageBlockButtons> 
     <apex:pageBlockSection title="Information"> 
     </apex:pageBlockSection> 
     <apex:pageBlockSection columns="1"> 
     <apex:pageBlockSectionItem > 
        <apex:outputLabel value="Related Object"></apex:outputLabel> 
         <apex:selectList value="{!objType}" size="1" onchange="fieldNamesList(this.options[this.selectedIndex].value);"> 
          <apex:selectOptions value="{!objOptions}"/> 
         </apex:selectList> 
       </apex:pageBlockSectionItem> 
       <apex:pageBlockSectionItem > 
         <apex:outputLabel value="Field Name"></apex:outputLabel> 
         <apex:outputPanel id="fieldPanel"> 
          <apex:outputPanel layout="block" styleClass="requiredInput"> 
           <apex:outputPanel layout="block" styleClass="requiredBlock"/> 
          <apex:selectList value="{!fieldName}" size="1" onchange="setFieldApiName(this.options[this.selectedIndex].value)"> 
           <apex:selectOptions value="{!fieldOption}"/> 
          </apex:selectList> 
          </apex:outputPanel> 
          </apex:outputPanel> 

        </apex:pageBlockSectionItem> 
       <apex:pageBlockSectionItem > 
        <apex:outputLabel value="Field Type"></apex:outputLabel> 
         <apex:outputPanel id="fieldTypeApiPanel"> 
          <apex:outputText value="{! fieldType}"/> 
          </apex:outputPanel> 
       </apex:pageBlockSectionItem> 
       <apex:pageBlockSectionItem > 
       <apex:outputLabel value="Operator" /> 
       <apex:outputPanel id="operatorPanel"> 
       <apex:selectList value="{!newRuleCriteria.Matching_Type__c}" size="1" > 
<apex:selectOptions value="{! Operator}" ></apex:selectOptions> 
</apex:selectList> 
</apex:outputPanel> 
</apex:pageBlockSectionItem> 
<apex:pageBlockSectionItem rendered="{! isPicklist}" id="picklist"> 
<apex:outputLabel value="Matching Value"> </apex:outputLabel> 
<apex:selectList value="{!newRuleCriteria.Matching_Value__c}" size="1" > 
          <apex:selectOptions value="{! PickListValues}"/>        
         </apex:selectList> 


</apex:pageBlockSectionItem > 
<apex:pageBlockSectionItem rendered="{! isInput}" id='input1'> 
<apex:outputLabel value="Matching Value"></apex:outputLabel> 
<apex:inputFIeld value="{! newRuleCriteria.Matching_Value__c}" /> 
</apex:pageBlockSectionItem> 
<apex:pageBlockSectionItem rendered="{! isCheckBox}" id='check'> 
<apex:outputLabel value="Matching Value"></apex:outputLabel> 
         <apex:inputCheckBox value="{! newRuleCriteria.Matching_Value__c}"/> 

</apex:pageBlockSectionItem> 
       </apex:pageBlockSection> 
     </apex:pageBlock> 
     <apex:actionRegion > 
     <apex:actionFunction name="fieldNamesList" action="{!getFieldNames}" reRender="fieldPanel"> 
     <apex:param assignTo="{!parentName}" value="" name="parentName"/> 
     </apex:actionFunction> 
    </apex:actionRegion> 
     <apex:actionRegion > 
     <apex:actionFunction name="setFieldApiName" action="{!setFieldApiName}" reRender="picklist,input1,check,operatorPanel,fieldTypeApiPanel"> 
     <apex:param value="" name="fieldName"/> 
     </apex:actionFunction> 
    </apex:actionRegion> 

     </apex:form> 
</apex:page> 

и функции кода расширения это

public pageReference setFieldApiName(){ 
    fieldName = Apexpages.currentPage().getParameters().get('fieldName'); 

    if(fieldName != null && fieldName.length() >0){ 
    fieldType = Schema.getGlobalDescribe().get(objType).getDescribe().fields.getMap().get(fieldName).getDescribe().getType().name(); 
    if(Schema.DisplayType.PickList == Schema.getGlobalDescribe().get(objType).getDescribe().fields.getMap().get(fieldName).getDescribe().getType()) 
{isPicklist=true; 
isCheckBox = false; 
isInput =false; 
isMinMax = false;} 
if(Schema.DisplayType.Boolean == Schema.getGlobalDescribe().get(objType).getDescribe().fields.getMap().get(fieldName).getDescribe().getType()) 
{isPicklist=false; 
isCheckBox=true; 
isInput= false; 
isMinMax= false; 
} 


    }else {fieldType=''; 
    isMinMax=isCheckBox=isPickList=false; 

    isInput=true; 
    } 
    System.debug('pick list is '+isPickList); 
    return null; 
    } 

на этой странице в одном списке выбора я показываю ярлык объектов, когда пользователь выбирает метку, а во втором списке я показываю поля, соответствующие этой метке, но когда я выбираю поле actionFunction selectFieldApiName called.and в журнале отладки показывает pick li st истинно. но не Picklist оказывает я думаю, после выбора поля Picklist ispickList получать истинное, а затем этот pageblocksection элемент должен оказывать

<apex:pageBlockSectionItem rendered="{! isPicklist}" id="picklist"> 
    <apex:outputLabel value="Matching Value"> </apex:outputLabel> 
    <apex:selectList value="{!newRuleCriteria.Matching_Value__c}" size="1" > 
           <apex:selectOptions value="{! PickListValues}"/>        
          </apex:selectList> 


    </apex:pageBlockSectionItem > 

но не оказывающего может любой, пожалуйста, где я wrong.please помощь !!

ответ

0

Я думаю, что вы хотите использовать здесь тег <apex:actionSupport> вместо тега <apex:actionFunction>. Вложил его в свой тег <apex:selectList>. Событие, которое вы хотите использовать здесь, - onChange.

Смежные вопросы