---
title: FAQ
project: jComponent V19
version: 19.194
section: faq
language: en
license: MIT
url: https://totaljs.es/docs/jcomponent-v19/19-194/faq/faq/
updated: 2026-11-18T13:55:44.124Z
---

# FAQ

> Answers to the questions developers ask most often when they start with jComponent.

Short answers to the questions that come up first. Each answer links to the page that explains the topic in full.

## Do I need a build step?

No. jComponent is a script that you include in the page. The published build also contains jQuery, the Tangular template engine and the routing. See [Getting started](../../guides/getting-started/).

## Why does the page not change when I assign a value to a variable?

A plain assignment does not tell the library that anything happened. Use `SET()`, or call `UPD()` after you change the object yourself:

```html
<script>
    var user = { name: 'Peter' };
</script>

<ui-bind path="user.name" config="text"></ui-bind>

<script>
    user.name = 'Lucia';       // The page still shows Peter
    UPD('user.name');          // The page shows Lucia
    SET('user.name', 'Anna');  // The page shows Anna
</script>
```

See [Paths](../../guides/paths/) and [Data binding](../../guides/data-binding/).

## How do I run code when a value changes?

Use `WATCH()`. The callback receives the path, the value and the type of the change:

```js
WATCH('cart.total', function(path, value, type) {
    console.log(path, value);
});

SET('cart.total', 5); // cart.total 5
```

See [Data binding](../../guides/data-binding/).

## Why does FIND() return nothing when my script starts?

Components are created after the scripts of the page have run. On a page with components, wait for the `ready` event:

```js
ON('ready', function() {
    var component = FIND('hello');
});
```

See [Using components](../../guides/using-components/) and the [events reference](../../reference/events/).

## When should I use a component, a plugin or a macro?

- A [component](../../guides/creating-components/) is a reusable piece of interface, such as an input or a grid.
- A [plugin](../../guides/plugins/) holds the data and logic of a part of the application, such as a page or a form.
- A [macro](../../guides/macros/) adds a small behaviour to a single `<ui-bind>` element.

## What does the question mark in a path mean?

Inside `<ui-plugin>`, `?` stands for the path of the plugin. With the plugin `orders`, `?.items` is `orders.items` and `?/refresh` is the method `refresh` of the plugin. See [Scopes](../../guides/scopes/).

## How do I call a plugin method from HTML?

Add the class `exec` and name the method in `data-exec`:

```html
<ui-plugin path="counter">
    <button class="exec" data-exec="?/increment">+1</button>
</ui-plugin>
```

From JavaScript, use `EXEC('counter/increment')`. See [Plugins](../../guides/plugins/).

## How do I render a list from an array?

Use the `template` command of `<ui-bind>` with a Tangular loop. The list is rendered again when the array changes:

```html
<script>
    var products = [{ name: 'Keyboard' }, { name: 'Mouse' }];
</script>

<ui-bind path="products" config="template">
    <script type="text/html">
        {{ foreach item in value }}<li>{{ item.name }}</li>{{ end }}
    </script>
</ui-bind>
```

`PUSH('products', { name: 'Monitor' })` adds a third item to the page. See [Templates with Tangular](../../guides/tangular/).

## Are values in templates safe against HTML injection?

`{{ value }}` is encoded. A command with a helper is not encoded unless you add the `encode` helper at the end, as in `{{ value | upper | encode }}`, and `raw` writes the value as it is. See [Templates with Tangular](../../guides/tangular/).

## How do I load part of a page on demand?

Use `IMPORT('/parts/form.html', '#target')` from code or `<ui-import config="url:/parts/form.html">` in the markup. See [Importing content](../../guides/importing/).

## Why did the script of an imported file run only once?

`<ui-import>` removes scripts and styles when the same address is imported again. Add `reevaluate:true` to the `config` attribute if each copy has to run its script. See [Importing content](../../guides/importing/).

## How do I show a "page not found" screen?

Listen to the `404` event, which is emitted when no route matches the address:

```js
ON('404', function() {
    SET('common.page', 'notfound');
});
```

See [Routing](../../guides/routing/).

## Why is my route never called?

Check the case and the number of segments. Addresses are compared in lowercase, so `ROUTE('/Admin/', fn)` never matches. Write it as `ROUTE('/admin/', fn)`. See [Routing](../../guides/routing/).

## How do I protect a route?

Declare a middleware with `MIDDLEWARE()`, name it in the route, and call `next(false)` to stop the navigation. See [Routing](../../guides/routing/).

## Why is my required field marked invalid on a fresh form?

An empty required field is invalid from the start, so it has the `ui-invalid` class right away. Combine the classes in your CSS to show the error only after the user has touched the field:

```css
.ui-touched.ui-invalid input { border-color: red; }
```

See [Forms and validation](../../guides/forms/).

## Why is my save button still disabled when the form is valid?

`CAN()` needs a valid form **and** at least one field the user has changed. Use `VALID()` if you only care about validity. See [Forms and validation](../../guides/forms/).

## Why is the text in my HTML not translated?

`@(text)` is translated in component configuration, in `<ui-bind>` templates and in imported content. Static HTML of the page stays as it is. See [Localization](../../guides/localization/).

## How do I change the date and number formats?

Set `DEF.dateformat`, `DEF.thousandsseparator` and `DEF.decimalseparator` when the application starts. See [Localization](../../guides/localization/).
