Placeholders are often used:
- Like a label, as in the above example. HTML5 warns against using placeholders as labels, as the information carried by the label won't be shown if the field isn't empty. So only use placeholders as labels in cases where, even if missing, there is little doubt as to the meaning of the fields. You can tell Orbeon Forms to show a label as a placeholder by setting an appearance="minimal" on the label, as in:
- Like a hint, placing the appearance="minimal" on the hint, as in:
When using a placeholder in XForms, if users access your form with a browser that:
- does supports HTML5 placeholders, Orbeon Forms leverages that native feature of the browser;
This way, you as an XForms author don't have to write different code for different browsers, or worry about browser compatibility, and your end users get the same rich user experience, even on browsers that don't support this HTML5 feature.