0% found this document useful (0 votes)
11 views16 pages

Frappe Framework Field Types Overview

Uploaded by

flujosn8n
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views16 pages

Frappe Framework Field Types Overview

Uploaded by

flujosn8n
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Field Types

There are variety of fieldtypes available in Frappe Framework. Each one has its own use case and
can be used to input and store different types of data in a document. Fieldtypes are used to
render components in desk as well as web forms.

New DocType

Fields

Fields

a Date

Attach
Add Row Attach Image
Barcode
Button

Naming

Auto Name
Data
Date
Datetime
Duration

Documentation Link

Data

The data field will be a simple text field. It allows you to enter a value of up to 140 characters,
making this the most generic field type.

You can enable validations for the following types of data:

Name
ee

Email

Phone

URL
a

by setting the options to "Name", "Email", "Phone" or "URL" respectively.


Fields

Fields

Subject Summary

Company Name Name

Secondary Phone Phone

Secondary Email Email

Company Website Link URL

Add Row

Link

Link field is connected to another master from where it fetches data. For example, in the
Quotation master, the Customer is a Link field. To know more, click here.

Dynamic Link

Dynamic Link field is one which can search and hold value of any document/doctype. Click here
to learn how Dynamic Link Field functions.

Check

This will enable you to have a checkbox here. You can set the ~Default~ value to 1 and it will be
checked by default.
@ Is Prime Mem

Editing Row #1 | | Insert Below InsertAbove —_¢) Duplicate

Label

Is Prime Member

Type

Check

Name

is_prime_member

Select

Using the field type "Select", you can create a drop-down field. You can specify all selectable
values in the Options field, each value separated by a new line.

One of the selectable values can be copied into the Default field. This value will then be selected
by default in a new form.

If you enable the Sort Options checkbox, values will be displayed in alphabetical order (in the
user's language).

The following screenshot shows how a "Select" field can be defined in the DocType or via
Customize Form:
Editing Row #9 | ) insert Below insert Above

Label and Type

on Fetch From if a value already exists.

And this is how it will be rendered in a new form:

Content

v HIM
Markdown
Page Builder

Slideshow

Table

With a "Table" field, you can render another DocType as a child table within your form.

First, you'll have to choose or define a DocType that has the Checkbox Is Child Table enabled.
Then you can add a field of type "Table" and paste the name of your child table DocType into the
Options field.

For example, ERPNext defines a child DocType called "Purchase Receipt Item" with Is Child Table
enabled:
=n
| E | > DocType > Purchase Receipt Item Q Search or type a command (Ctrl + G)

Purchase Receipt Item

Module

Beta

Is Virtual

are implemented using Nest

Is Calendar and Gantt

Enables Calendar and Gantt views.

{ad Editable Grid

Fields

barcode

Another DocType called "Purchase Receipt" has a field of type "Table", with Options set to above
child doctype "Purchase Receipt Item":

Editing Row #39 : J ) insert Below Insert Above Duplicate

Purchase Receipt Item

G2 Mandatory

Virtual

Index

Defaults
Default

Finally, the child table will be rendered in the Purchase Receipt form:
Get Items From =

Add Multiple Add Row Download Upload

Total Quantity

Taxes and Charges

Tax Category

Purchase Taxes and Charges Template

Attach

Attach field allows you to browse a field from the File Manager and attach the same herein.

B > Website > Upload > new-upload-1 command (Ctrl + G)

= New Upload : woisavea

Data File

Attach Drag and drop files here or upload from

My Device Library

Set all private

Attach Image

Attach Image is a field wherein you will be allowed to attach Images of the format jpeg, png, etc.
This becomes the Image representing that particular DocType. For e.g., you would want the image
of an Item in its DocType, you can choose your field to be an Attach Image Field.

Text Editor
Text Editor is a text field and renders a WYSIWYG editor for input. It has various text-formatting
options.

Blog Content

Normal oA 59° </> ® &

My First Blog Post


Hello, world!

Date

This field will enable you to enter the Date in this field.

Publish Date

Today

Date and Time

This field will give you a date and time picker. The current date and time (as provided by your
computer) are set by default.

Barcode

In this field, you can specify the field as Barcode which will allow you to enter a Barcode number.
Once you do that, the Barcode would automatically get generated against the number.
Barcode

Hella, World!

UT AYU TN AREAUTR ATE Hello, World!

Button

This field lets you place a button in a document. This can be used to perform specific actions like
publishing a blog post, triggering an action etc.

Code

This fieldtype can be used to take ~code’ as input. A code editor is rendered in the document
form. Optionally, you can provide a langauge in the fieldtype options to enable syntax
highlighting. For example, below is a “code type field with options set to ~python :

You can enable basic syntax validations for following languages by setting "Option".

1. Python (for scripts)

2. PythonExpression (for simple one-line expressions that must evaluate to a value) E.g.
Assignment Rule condition

Example of differences between ~Python’ and ~PythonExpression :

e variable = 42> is avalid ~Python’ code but nota valid ~PythonExpression since the

assignment doesn't evaluate to any value.

e variable == 42> is both valid ~Ppython’ code and valid ~pythonExpression as the
expresion can evaluate to some value.
Script

1 from pathlib import Path

3 index_file = Path('.') / ‘inde


4
5+ if not index_file.exists():
6 index_file.touch()

Color

This will let the user input a color via a rendered color picker or directly input a hexadecimal color.

Q_ Search or type a command (Ctrl + G)

COLOR PICKER

Theme Color

Column Break

This is a ~'meta'~ fieldtype that does not store any input data but can be used to indicate a
column break in the document view or form.

For example,
Fields

Fields

No. Label Type Name Man... Options

1 Primary Color Color theme_color 7 Edit

Column Break column_break_6 2 Edit

Secondary Color Color secondary_color 2 Edit

will result into:

Primary Color Secondary Color

J eo

Currency

Currency field holds numeric value, like Item Price, Amount, etc. Currency field can have value up
to six decimal places. Also, you can have a currency symbol being shown for the currency field.

Float

Float field carries numeric value, up to nine decimal places.

Geolocation

A Geolocation field will show a map view on which you can draw polygons, lines, and points. The
data is stored as a GeoJSON feature_collection.

If you add a Geolocation field with the exact field name "location", you will get an additional map
view (the equivalent of list view, but on a map). By the way, this also works if you create two
separate fields named "latitude" and "longitude".

Note: Frappe uses the "Leaflet" library which stores coordinates as [latitude, longitude] which is
the reverse of what GeoJSON usually does.

HTML
This will render the content entered in ~Options’ as HTML in the document form or view page.
Here is an example:

Editing Row #2 Insert Below Insert Above CO) Duplicate Move

Label Options

Warning <p class="alert alert-warning">


Your library
membership is about to expire!</p>

Type *

HTML

Name

warning
1 0n a new line

Index
Default
In List View

In Standard Filter

will result into:

Name

Hussain Nagaria

Your library membership is about to expire!

Image

Image field will render an image file selected in another attach field.

For the Image field, under Option (in Doctype), a field name should be provided where the image
file is attached. By referring to the value in that field, the image will be a reference in the Image
field.

Fields

Type

Name Data name

Cover Image Attach Image cover_image

Book Cover Image Image book_cover_image cover_image

Add Row
will result into:

Name

Purple Flower

Cover Image

% [Link] Clear

Int (Integer)

The integer field holds numeric value, without decimal place.

Small Text

Small Text field carries text content and has more character limit than the Data field.

Long Text

You can define your field to a Long Text Field when you would want to enter data with an
unlimited character limit.

Text

This field type would allow you to add text in the field. The character limit in Small text, Long text
and Text fields shall be determined based on the Relational Database Management System.

Markdown Editor

This field will allow you to add the text in markdown. This fieldtype also provides a ~ Preview
view of rendered HTML:
Blog Content

Preview

when preview is clicked:

Blog Content

Edit

How to create awesome apps with Frappe?


1. Follow In ation docs
2. Go thr > tutorial
3. Experiment on your own

Collapse

Password

The password field will have decoded value in it. This type of field can be used to store sensitive
data like passwords, pass phrases, secret keys etc.

Percent

You can define the field as a Percentage field which in the background will be calculated as a
percentage.

Rating

This field can be used to display an interactive star rating input. The default star count shown is 5,
however, this can easily be changed by entering a number ranging from 3 - 10 in the options field
for that particular rating field.
New Subscription

Subscription Type

Monthly

Rate your experience

You can also provide half ratings e.g 3.5 out of 5.

New Rating

Rating

Read Only

Read Only field will carry data fetched from another form which will be non-editable. You should
set Read Only as field type if its source for value is predetermined.

Section Break

Section Break is used to divide the form into multiple sections. Any fields that follow (and before
any other ~Section Break’ ) a ~Section Break field will be part of this new section.
Expand

Rating

My New Section

Address

Jagdalpur, Bastar
494001
reney

Tab Break

Tab Break is used to divide the form into multiple tabs. Any field that follow till the next ~Tab
Break will be the part of this new tab.

B>

shariq@[Link]

Personal Information

Note: If the ~fields~ table of a DocType is not started with a Tab Break, a default Tab Break
named “Details will be used. This happens only if a DocType has atleast one ~Tab Break~ in
the ~fields~> table.

Signature

You can define the field to be a Signature field wherein you can add the Digital Signature in this
field. Read documentation for Signature Field to know more.

Table MultiSelect
This is a combination of 'Link' type and 'Table' type fields. Instead of a child table with 'Add Row'
button, in one field multiple values can be selected.

Time

This is a Time field where you can define the Time in the field.

Duration

You can use the Duration field if you want to define a timespan.

If you don't want to track duration in terms of days or seconds, you can enable "Hide Days" and
"Hide Seconds" options respectively in your Form. One day is equivalent to 24 hours.

JSON

This creates a JSON type column in your database. Also adds syntax highlighting for Desk
controls.

You might also like