# The \`.value\` is a lie.🎂 (on viewof'ed inputs at least)

**URL:** <https://talk.observablehq.com/t/the-value-is-a-lie-on-viewofed-inputs-at-least/4343>\
**Category:** Help\
**Created:** [December 16, 2020, 12:42pm UTC](https://talk.observablehq.com/t/the-value-is-a-lie-on-viewofed-inputs-at-least/4343 "2020-12-16T12:42:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [December 16, 2020, 1:31pm UTC](https://talk.observablehq.com/t/the-value-is-a-lie-on-viewofed-inputs-at-least/4343/2 "2020-12-16T13:31:56Z")

</div>

Think of `viewof` as a macro that produces an additional Runtime `Variable` (internal represenation of a cell) for your viewof cell, so that you end up with two Variables:

- `viewof box`, the cell that you originally defined,
- `box`, which is a generator cell that listens to changes in `viewof box` via Generators.input and yields the new value.

Generators.input has some “magic” for inputs. Depending on the input type, it will:

- listen to different events (e.g. “click” for checkboxes),
- cast the value (e.g. via `.valueAsNumber()` for number and range inputs).

You can find the implementation details here:

> <https://github.com/observablehq/stdlib/blob/master/src/generators/input.js>

In general I find that looking at a notebook’s generated source can give some insight into the underlying logic, e.g.:  
[https://api.observablehq.com/@observablehq/introduction-to-views.js?v=3](https://api.observablehq.com/@observablehq/introduction-to-views.js?v=3)

---

_[View the full topic](https://talk.observablehq.com/t/the-value-is-a-lie-on-viewofed-inputs-at-least/4343)._
