# set\_value

Source: https://zotonic.com/docs/1812/set_value

URI: https://zotonic.com/id/1812

Language: en



Set the value of a form field.

Example:

```erlang
<input type="text" id="x" name="xyz" value="">
{% button text="fill" action={set_value target="x" value="etaoinstrdlu"} %}
```

Clicking on the button will set the value of the input element to the most interesting string `etaoinstrdlu`.

This action can set the value of any input element, select or text area. It uses the jQuery `val()` method to set the value.

Optionally the argument `trigger_event` can be passed to trigger a change event:

```erlang
{% button text="fill" action={set_value target="x" value="..." trigger_event} %}
```

To trigger a custom event:

```erlang
{% button text="fill" action={set_value target="x" value="..." trigger_event="myevent"} %}
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1812?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1812?language=en>)
