Skip to main content

Avatar

A compact but useful control for swift uploading of an avatar into a form.

Avatar control

Related sample: Form. All controls

Related sample: Form. Avatar

Adding Avatar

You can easily add an Avatar control during initialization of a form:

const form = new dhx.Form("form_container", {
rows: [
{
type: "avatar",
name: "avatar",
required: true,
labelWidth: 140,
label: "Employee photo",
labelPosition: "top",
placeholder: "Add a photo",
value: {
src: "https://server.domain/upload/image.jpg"
}
}
]
});

Properties

View the full list of configuration properties of the Avatar control.

Working with Avatar

You can manipulate an Avatar control by using methods or events of the object returned by the getItem() method.

For example, you can get the value of the control:

const value = form.getItem("avatar").getValue();

Methods

Check the full list of methods of the Avatar control.

Events

Check the full list of events of the Avatar control.