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
jasmin05jasmin05 

Can't get input data from VF <Winter 14 VS Summer 14?>

Hi,
I developed the following code in Winter 14 (sandbox) and it works correctly.
But when I deployed it to Summer 14 (production environment), I could not update the "Status__c" data.
Please help me to resolve this issue...

********** Visualforce Code************

<apex:form id="theForm">
    <apex:pageblock id="theBlock" tabstyle="Bulk_Edit__tab" mode="maindetail">
        <!-- ============================== -->
        <!-- Command Buttons                -->
        <!-- ============================== -->
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Edit" action="{!editBulk}" rendered="{!!isBulkEdit}"/>
            <apex:commandButton value="Save" action="{!saveBulk}" rendered="{!isBulkEdit}"/>
            <apex:commandButton value="Cancel" action="{!cancelBulk}" rendered="{!isBulkEdit}"/>
        </apex:pageBlockButtons>
        <apex:outputPanel >
            <apex:inputHidden value="{!tableHeight}" id="tableHeight" />
        </apex:outputPanel>
              
        <apex:outputPanel layout="block" id="refTablePanel" style="width:100%">
            <apex:outputPanel >
                <div class="hideCurrDate">
                <div id="listTableDiv" class="superTablesDiv" style="width:1500px; height:{!tableHeight}px;">
                    <table id="listTable" width="95%">
                    <!--======================-->
                    <!-- HEADER                               -->
                    <!--======================-->                       
                        <tr>
                            <!--★Column1-->
                            <th><span style="width:70px; overflow: hidden; white-space: nowrap; text-overflow: string; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block; ">
                                <apex:outputText value="Column1"/>
                                </span>
                            </th>
                            <!--★Column2-->
                            <th><span style="width:70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block;">
                                <apex:outputText value="Column2"/>     
                                </span>
                            </th>
                            <!--★Status-->
                            <th><span style="width:600px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; display:block;">
                                <apex:outputText value="Status"/>     
                                </span>
                            </th>
                        </tr>
                   <!--======================-->
                   <!-- DATA                                    -->
                   <!--======================-->
                        <apex:repeat value="{!reportItemList}" var="objItem">
                            <apex:variable value="{!1}" var="rowNum"/>
                            <apex:repeat value="{!objItem.itemData}" var="i" >
                                <tr onmouseover="mover(this);"  onmouseout="mout(this);">
                                    <!--★Column1-->
                                    <td class="{!if(rowNum==1,'show','hidden')}" rowspan="{!objItem.itemData.size}">
                                        <span style="white-space: normal; overflow:hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                            <apex:outputField value="{!objItem.mer.name}" rendered="{!if(rowNum==1,true,false)}"/>
                                        </span>
                                    </td>
                                   
                                    <!--★Column2-->
                                    <td><span style="overflow: hidden; white-space: normal; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                        <apex:outputField value="{!i.Column2__c}"/>
                                        </span>
                                    </td>
                                  
                                    <!--★Status-->
                                    <td class="{!if(rowNum==1,'show','hidden')}" rowspan="{!objItem.itemData.size}">
                                        <span style="overflow: hidden; white-space: normal; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; word-wrap:break-word; display:block;">
                                            <apex:outputField value="{!objItem.mer.Status__c}" rendered="{!if(rowNum==1,true,false)&&!isBulkEdit}"/>
                                            <apex:inputField value="{!objItem.mer.Status__c}" rendered="{!if(rowNum==1,true,false)&&isBulkEdit}" style="width:90%;"/>
                                        </span>
                                    </td>
                                </tr>
                                <apex:variable var="rowNum" value="{!rowNum + 1}"/>
                            </apex:repeat>
                        </apex:repeat>
                    </table>
                </div>
                </div>
            </apex:outputPanel>
        </apex:outputPanel>
   </apex:pageBlock>
</apex:form>


********** Apex Class Code************

public class MER_Bulk_Ext {
    //==========================================================
    // Public Fields
    //==========================================================
    public List<ReportItem> reportItemList{get; set;}
    public Boolean isBulkEdit{get; set;}
    public Integer tableHeight {get; set;}
    //==========================================================
    // Private Fields
    //==========================================================
    //Property for Paging
    @TestVisible private ApexPages.StandardSetController stdSetCntrl {get;set;}
    private Integer totalId;
   
    //================================================================
    // Constructor
    //================================================================
    public MER_Bulk_Ext(ApexPages.StandardController controller) {

        List<MER__c> merList = new List<MER__c>();
            merList = [SELECT m.name,
                         m.Status__c,
                         (SELECT i.Column2__c
                            FROM MER_Itemized_Status__r i) itemData
                     FROM MER__c m
                 ORDER BY m.name
                 ];
           
        for(MER__c m: merList){
            ReportItem objItem = new ReportItem();
            objItem.mer = m;
            objItem.itemData = m.MER_Itemized_Status__r;
        }

        this.stdSetCntrl = new ApexPages.StandardSetController(merList);
        this.stdSetCntrl.setPageSize(100);
        this.reportItemList = this.generateMERList();
        this.tableHeight =615;
    }
  
    // Inner Class Definition
    public Class ReportItem {
        public MER__c mer {get; set;}
        public List<MER_Itemized_Status__c> itemData {get; set;}
    }
   
    //---------------------------------------------------------------
    // [save] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference saveBulk(){
        List<MER__c> updateMer = new List<MER__c>();
        List<MER_Itemized_Status__c> updateItem = new List<MER_Itemized_Status__c>();
        for (ReportItem mer : this.reportItemList) {
            updateMer.add(mer.mer);
            for(MER_Itemized_Status__c i:mer.mer.MER_Itemized_Status__r){
                updateItem.add(i);
            }
        }
        try {
            if (updateMer.size() > 0) {
                update updateMer;
                ★I can not get the input data from VF. Status__c is not updated.★
            }
            if (updateItem.size() > 0) {
                update updateItem;
            }
        } catch (DMLException e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDMLMessage(0)));
            return null;
        }
        isBulkEdit=false;
        PageReference pgr = Page.MER_BulkEdit;
        pgr.setRedirect(true);
        return pgr;
    }
   
    //---------------------------------------------------------------
    // [Edit] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference editBulk(){
        PageReference pgr = new PageReference('/apex/MER_BulkEdit');
        isBulkEdit=true;
        return pgr;
    }
   
    //---------------------------------------------------------------
    // [Cancel] Button in Page[MER_BulkEdit]
    //---------------------------------------------------------------
    public PageReference cancelBulk(){
        PageReference pgr = new PageReference('/apex/MER_BulkEdit');
        isBulkEdit=false;
        return pgr;
    }
   

   
    //==========================================================
    // Private Method
    //==========================================================
    public List <ReportItem> generateMERList() {
        List<ReportItem> customList = new List<ReportItem>();
       
        for (MER__c mer : (List<MER__c>)this.stdSetCntrl.getRecords()) {
            ReportItem merItem = new ReportItem();
            merItem.mer = mer;
            merItem.itemData = mer.MER_Itemized_Status__r;
            customList.add(merItem);
        }
        return customList;
    }
}
************************************************************************:
Thank you in advance for your help!
Best Answer chosen by jasmin05
jasmin05jasmin05
Finally the issue was resolved!!
I removed <apex:variable value="{!1}" var="rowNum"/>.
And added count function to Apex Class.
Then I can update the Status__c field.
I don't know why <apex:variable value="{!1}" var="rowNum"/> was the reason of this issues.
But anyway now the application works correctly.
Thank you very much for your kind support!

All Answers

Tony TannousTony Tannous
Dear,

can you check the security of the field Status__c if it is visible for all the profile or it is readonly mode.

Good Luck 
jasmin05jasmin05
Dear Tony Tannous,

Thank you very much for your reply.
I checked the security settings but Status__c is editable.
When I removed "rendered" as below, I could update the Status__c.
I think "rendered" behavior is not same between Summer 14 and Winter 14.
But I don't know how to overcome this issue...

Before;
<apex:inputField value="{!objItem.mer.Status__c}" rendered="{!if(rowNum==1,true,false)&&isBulkEdit}" style="width:90%;"/>
=> Can not update Status__c

After;
<apex:inputField value="{!objItem.mer.Status__c}" style="width:90%;"/>
=> Can update Status__c

Thank you.
Tony TannousTony Tannous
Dear Jasmin,


are you sure that the value of this rowNum is 1 and isBulkEdit = true so the <apex:inputField /> will be renderef because if 1 of these 2 conditions is false the field will not be rendered.

can you try to put them on the VF page to be sure 100 %.

Good Luck
jasmin05jasmin05
Dear Tony Tannous,

Yes, I confirmed that rowNum is 1 and isBulkEdit=true.
I think this issue point is that this code worked correctly in sandbox...
The difference between the sandbox and production environment is only the salesforce version.
Sandbox is Winter 14 and production environment is Summer 14.

Thank you.
jasmin05jasmin05
Dear Tony Tannous,

I might find the reason.
If the total number of MER__c Object is one, I could not update the Status__c though the version is Winter 14 !
If there are any MER__c Object which doesn't have MER_Itemized_Status__c Object, I could update the Status__c.

I will investigate more...
jasmin05jasmin05
I still can not update the Status__c field...
I don't know why it is not updated if there is only one MER__c.
jasmin05jasmin05
Finally the issue was resolved!!
I removed <apex:variable value="{!1}" var="rowNum"/>.
And added count function to Apex Class.
Then I can update the Status__c field.
I don't know why <apex:variable value="{!1}" var="rowNum"/> was the reason of this issues.
But anyway now the application works correctly.
Thank you very much for your kind support!
This was selected as the best answer