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
Lisa SeilerLisa Seiler 

inputField on VF Page is not working

Hi @ all,
I want to create inputFields to save new values to a "Order".
First the structure. I have a Event with some Orders and the Order can have Order Items. All are in master-detail.
I have a VF-Page with a extension and standardController is Event.. In a table I call all Order Items related to one Event. This is no problem. My problem is, the field I want to fill is on the Order. I catch the field in my method and write it down to the page. But the page shows not the inputField...it shows only the value so I cannot save new values(there is no field to write something)....is someone understand me and able to help me?
Following are my code-snippets:
This is my VF-Page. If I get a inputField from the Event it is working perfectly...If I get the Order fields....it is not working:
<apex:column headerValue="Korrektur Preis Netto"><apex:inputField html-placeholder="Preis Netto" type="auto" value="{!o.Order__r.New_Net_Total__c}" /></apex:column> />
                    <apex:column headerValue="Anzahl an Gästen" value="{!o.Order__r.Number_of_Guests__c}"/>
                    <apex:column headerValue="Korrektur Anzahl der Gäste"><apex:inputField html-placeholder="Anzahl an Gästen" type="number" value="{!o.Order__r.New_Number_of_Guests__c}" /></apex:column> />

This is the related extension-class:
public List<Order_Item__c> getorderItems(){
        List<Order_Item__c> currentOrderItems = new List<Order_Item__c>();
        List<Order_Item__c> returnOrderItems = new List<Order_Item__c>();
        String orderItems;
        currentOrderItems = [SELECT Id, Order__c, Order__r.New_Number_of_Guests__c, Order__r.New_Net_Total__c, Caterer__r.Name, Net_Price__c, MenuId__r.Name, Category__c, Order__r.Number_of_Guests__c FROM Order_Item__c WHERE (Order__r.Event__c =: event.Id) AND (Caterer__c =: catererid)];
        for(Order_Item__c oi : currentOrderItems){
            if(oi.Category__c == 'Menu'){
                returnOrderItems.add(oi);
            }
        }
        return returnOrderItems;
    }
Here screenshot form both sides:
Event inputField
event input field
order inpoutField
order input field

Best,
Lisa
 
Aman MalikAman Malik
Hi Lisa,
Below is the link with a similar issue and workaround.
https://salesforce.stackexchange.com/questions/148836/master-detail-field-not-showing-on-vf-page-with-custom-controller/148849
Please let us know if this helps.

Kindly mark this as solved if it's resolved.

Thanks,
Aman