Visualforce apex:inputfieldコンポーネントの使い方のサンプル

環境
salesforce

構文
1.<apex:inputfield>
<apex:inputField> コンポーネントは、項目が必須であるかまたは一意であるかどうかなどの関連項目の属性、
およびユーザからの入力を取得するために表示するユーザインターフェースウィジェットを考慮します。

2.apex:pageBlockButtons
<apex:pageBlockButtons> コンポーネント内の任意のレベルに存在するボタンに、適切なスタイルが適用されます。

3.apex:pageBlockSection
<apex:pageBlockSection> コンポーネントは、1 つ以上の列で構成されており、
各列には、項目の表示ラベルとその値の 2 つのセルがあります。

サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<apex:page standardController="Contact" >
<apex:form >
<apex:pageBlock title="Edit Contact">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Contact.FirstName}"/>
<apex:inputField value="{!Contact.LastName}"/>
<apex:inputField value="{!Contact.Email}"/>
<apex:inputField value="{!Contact.Birthdate}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:page standardController="Contact" > <apex:form > <apex:pageBlock title="Edit Contact"> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Contact.FirstName}"/> <apex:inputField value="{!Contact.LastName}"/> <apex:inputField value="{!Contact.Email}"/> <apex:inputField value="{!Contact.Birthdate}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
<apex:page standardController="Contact" >
    <apex:form >
        <apex:pageBlock title="Edit Contact">
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!Contact.FirstName}"/>
                <apex:inputField value="{!Contact.LastName}"/>
                <apex:inputField value="{!Contact.Email}"/>
                <apex:inputField value="{!Contact.Birthdate}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Salesforce

Posted by arkgame