# Calendar

The **Calendar** field is an input component used to capture **date values** in a Smart Form.\
It provides a date input box with an optional **calendar picker**, allowing users to select dates accurately and consistently.

The Calendar field helps standardize date input and reduces formatting errors during data entry.

***

### Purpose of Calendar Field

The Calendar field is designed to:

* Allow users to input date values easily
* Provide a visual calendar picker for date selection
* Ensure consistent date formatting
* Support date‑based searching and filtering

#### Typical Use Cases

* Date of birth
* Start date / End date
* Transaction date
* Due date
* Appointment or schedule date

***

### Adding and Configuring a Calendar Field

To add a Calendar field:

1. Drag the **Calendar** field into a Module layout
2. Click the **Edit (pencil) icon** on the field
3. The **Calendar Configuration** window opens

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FR96PD1rCtmGlnl3V1SbH%2Fimage.png?alt=media&#x26;token=f62e1b1a-2d91-405a-a165-36ca676c0c7a" alt=""><figcaption></figcaption></figure>

***

### Calendar Configuration Properties

#### 1️. Core Identification

| Property  | Mandatory | Description                        |
| --------- | --------- | ---------------------------------- |
| **MF ID** | Yes       | System‑generated unique identifier |

***

#### 2️. Field Behavior & Appearance

| Property              | Description                                                      |
| --------------------- | ---------------------------------------------------------------- |
| **Source Tag**        | JavaScript injected at field level (e.g. `readonly`, `onchange`) |
| **Max Length**        | Maximum content length to be stored (default: 20)                |
| **Size**              | Display width of the field (default: 20)                         |
| **Use Calendar**      | Enables or disables the calendar picker icon                     |
| **Buddhist Calendar** | Enables Buddhist date format (Thai calendar)                     |

***

#### 3️. Database Mapping

| Property      | Description                          |
| ------------- | ------------------------------------ |
| **Field\_ID** | Database column mapped to this field |

***

#### 4️. Display & Search Configuration

| Property              | Description                                            |
| --------------------- | ------------------------------------------------------ |
| **ShowFieldName**     | Label displayed on the form (auto‑generated supported) |
| **SearchCriteria**    | Enables field as a search criterion                    |
| **ShowSearch**        | Displays field in search result table                  |
| **SearchFromTo**      | Enables date range search (From–To)                    |
| **SearchPreLike**     | Enables wildcard `%XXX` search                         |
| **SearchLike**        | Enables wildcard `XXX%` search                         |
| **SearchIgnoreCase**  | Case‑insensitive search                                |
| **JoinSearchTable**   | Used when JOIN SQL is required                         |
| **SearchFieldGroup**  | Horizontal position in search criteria                 |
| **SearchCriteriaSeq** | Vertical position in search criteria                   |
| **ShowSearchSeq**     | Order in search result list                            |

***

#### 5️. UI & Behavior Flags

| Property        | Description                               |
| --------------- | ----------------------------------------- |
| **Alignment**   | Text alignment: Left / Center / Right     |
| **OnlyGuiFlag** | UI‑only field (not persisted to database) |
| **ViewFlag**    | Displays field in read‑only mode          |
| **KeepHistory** | Persists history of date changes          |
| **FilterFlag**  | Filters records in 1‑Many Modules         |
| **Authen**      | Applies IAM‑based authorization           |
| **MergeFlag**   | Field spans across multiple columns       |

***

#### 6️. Validation Rules (Validate Code)

Validation logic applied before saving the form.

| Code                 | Description                                          |
| -------------------- | ---------------------------------------------------- |
| `CHECK_NULL`         | Prevents saving if the date is null                  |
| `CHECK_INTEGER`      | Ensures integer value (rarely used with Calendar)    |
| `CHECK_DECIMAL`      | Ensures decimal value                                |
| `CHECK_EMAIL_FORMAT` | Email format check (not commonly used with Calendar) |

> **Note**\
> In practice, `CHECK_NULL` is the most common validation applied to Calendar fields.

***

### Usage Guidelines

* Use Calendar for **date‑only values**
* Enable **Use Calendar** to reduce manual input errors
* Use **SearchFromTo** for date range queries
* Enable **Buddhist Calendar** when working with Thai date standards
* Ensure database column type supports date/time values
* Avoid using Calendar for date‑time with hours/minutes unless supported elsewhere

***

### Summary

The **Calendar** field provides a standardized and user‑friendly way to input and manage **date values** in ONEWEB Smart Forms.

Key points:

* Date input with optional calendar picker
* Supports search, filtering, and range queries
* Can use Buddhist calendar format
* Integrates with validation, IAM, and history tracking
* Essential for date‑based business data

When used appropriately, Calendar fields improve **data accuracy, usability, and consistency** across enterprise applications.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onewebstack.com/oneweb-platform-th/designer-reference/app-designer/entity/create-new-entity/fields/calendar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
