Book Image

PrimeFaces Cookbook

Book Image

PrimeFaces Cookbook

Overview of this book

Table of Contents (20 chapters)
PrimeFaces Cookbook Second Edition
Credits
Foreword
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Advanced editing with an in-place editor


The inplace component provides easy in-place editing and inline content display. It consists of two members:

  • The display element that is the initial clickable label

  • The inline element, which is the hidden content that'll be displayed when the display element is toggled

How it works…

The basic declaration of the component would be as follows:

<p:inplace>
  <h:inputText value="Edit Me!" />
</p:inplace>

This would render an input text field that could be clicked by the user to go into the edit mode. To go out of the edit mode, the user needs to click on the Enter button after typing.

By default, the inplace component displays its first child's value as the label; this can also be customized with the label attribute. This attribute defines the label that will be shown in the display mode regardless of the text input by the user:

<p:inplace label="My Input Field">
  <h:inputText value="Edit Me!" />
</p:inplace>

The emptyLabel...