Visualforce コンポーネントのカスタム HTML 属性の設定
任意の属性を多くの Visualforce コンポーネントに追加し、表示される HTML に「パススルー」することができます。たとえば、Visualforce と jQuery Mobile、AngularJS、Knockout などの JavaScript フレームワークを併用するとき、data-* またはその他の属性をフレームワーク関数を有効化するフックとして使用する場合に、この機能は便利です。
パススルー属性は、placeholder「ゴースト」テキスト、pattern クライアント側検証、title ヘルプテキスト属性などの HTML5 機能の使いやすさを向上させるためにも使用できます。
パススルー属性は、次の Visualforce コンポーネントでサポートされています。
- <apex:column>
- <apex:commandButton>
- <apex:commandLink>
- <apex:component>
- <apex:dataTable>
- <apex:form>
- <apex:iframe>
- <apex:image>
- <apex:includeScript>
- <apex:input>
- <apex:inputCheckbox>
- <apex:inputField>
- <apex:inputHidden>
- <apex:inputSecret>
- <apex:inputText>
- <apex:inputTextarea>
- <apex:messages>
- <apex:outputField>
- <apex:outputLabel>
- <apex:outputLink>
- <apex:outputPanel>
- <apex:outputText>
- <apex:page>
- <apex:pageBlock>
- <apex:pageBlockButtons>
- <apex:pageBlockSection>
- <apex:pageBlockSectionItem>
- <apex:pageBlockTable>
- <apex:panelBar>
- <apex:panelBarItem>
- <apex:panelGrid>
- <apex:sectionHeader>
- <apex:selectCheckboxes>
- <apex:selectList>
- <apex:selectOption>
- <apex:selectOptions>
- <apex:selectRadio>
- <apex:stylesheet>
- <apex:tab>
- <apex:tabPanel>
パススルー属性をサポートするコンポーネントを使用して生成できない HTML マークアップを作成するには、Visualforce タグと静的 HTML を組み合わせます。たとえば、jQuery Mobile の listview を作成するには、<apex:repeat> タグと必要な HTML タグを組み合わせます。
パススルー属性は、動的 Visualforce ではサポートされていません。