97
PrimeFaces Signature
It is used to draw a signature as an input. It provides a canvas where we can draw signature. It provides various options such as background color, foreground color, thickness for customization. It can be used in touch enabled devices. In JSF application, we can create it by using the <p:signature> component. It also provides various attributes that are tabled below.
Signature Attributes
Attribute | Default value | Type | Description |
---|---|---|---|
id | null | String | It is used to unique identifier of the component. |
rendered | true | Boolean | It is used to specify the rendering of the component. |
value | null | Object | It is used to set value of the component. |
required | false | Boolean | It is used to mark the component as required. |
validator | null | MethodExpr | It is used to set validator. |
requiredMessage | null | String | It is used to set message to be displayed when required field validation fails. |
widgetVar | null | String | It is a name of the client side widget. |
backgroundColor | #ffffff | String | It is used to set background color. |
color | #000000 | String | It is used to set foreground color. |
thickness | 2 | Integer | It is used to set thickness of the lines. |
style | null | String | It is used to set inline CSS of the component. |
readonly | false | Boolean | It is used to make component readonly. |
guideline | false | Boolean | It is used to set a guildeline. |
guidelineColor | #a0a0a0 | String | It is used to set color of the guideline. |
guidelineOffset | 25 | String | It is used to set offset of guideline from bottom. |
guidelineIndent | 10 | Boolean | It is used to set guide line indent from the edges. |
onchange | null | String | It is used to execute script when signature changed. |
base65Value | null | String | Write-only value used to pass the value in base64 to backing bean. |
Example
Here, in the following example, we are implementing <p:signature> component. This example contains the following files.
JSF File
// signature.xhtml
ManagedBean
// SignatureDemo.java
Output:
Next TopicPrimeFaces Spinner