+ Start a Discussion
Peter BölkePeter Bölke 

Problem with VF page for new and edit

Hello,

i have custom VF-Page which works for "edit"-mode. But i need this one also for adding new data. 
 
<apex:page standardController="Contact" extensions="TestFriends" showHeader="true" sidebar="true">
    <apex:slds />
    <div class="slds-scope">
        <apex:detail subject="{!contact.Id}" relatedList="true" inlineEdit="true"/>
        <apex:form >

            <apex:pageBlock title="Friends" id="data0">
                <ul class="slds-list--horizontal slds-has-cards--space has-selections">
                    <apex:repeat value="{!friends}" var="eve" >
                        <br></br> 
                    <li class="slds-list__item">
                        <div class="slds-card">
                            
                        
                        <div class="slds-card__header">Friend</div>
                        <div class="slds-tile slds-tile--board">
                            <p class="slds-tile__title slds-truncate"> 
                                <apex:outputField label="Name:" value="{!eve.Name}" title="{!eve.Name}"/>
                            </p>
                            <p class="slds-tile__title slds-truncate"> 
                                <apex:outputField label="Gender" value="{!eve.Gender__c}" title="{!eve.Gender__c}"/>

                            </p> 
                        </div>
                            </div>
                    </li>
                    <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
                </apex:repeat>
            </ul>
            <apex:pageBlockButtons >
                        <apex:commandButton value="Edit" action="{!save}" id="editButton" />
                        <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                        <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
                        <apex:commandButton value="add row" action="{!addRowToTable}" id="addRowButton" reRender="data0" />
                    </apex:pageBlockButtons>
        </apex:pageBlock>
        
    </apex:form>
</div>
</apex:page>

Can anyone give an advise what i need to change?

thanks
Peter
Best Answer chosen by Peter Bölke
RD@SFRD@SF
Yup, we cannot use apex detail in new records creation, you ll have to build the form from scratch, use field sets.

All Answers

RD@SFRD@SF
Hi Peter,

I think you should be alright if you just override the new link in the object settings with your VF page.

Hope it helps
RD 
Peter BölkePeter Bölke
it seems, that "apex:detail" is not working on "new" for the reason that it needs an exisiting id
RD@SFRD@SF
Yup, we cannot use apex detail in new records creation, you ll have to build the form from scratch, use field sets.
This was selected as the best answer
Peter BölkePeter Bölke
thats poor....