# Phoenix Form default values

**URL:** <https://forum.elixirforum.com/t/phoenix-form-default-values/22813>\
**Category:** Questions\
**Tags:** forms, phoenix, database\
**Created:** [May 31, 2019, 9:41am UTC](https://forum.elixirforum.com/t/phoenix-form-default-values/22813 "2019-05-31T09:41:54Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![cnck1387](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/32.png) [@cnck1387](https://forum.elixirforum.com/u/cnck1387)\
**Post date:** [May 31, 2019, 12:34pm UTC](https://forum.elixirforum.com/t/phoenix-form-default-values/22813/3 "2019-05-31T12:34:45Z")

</div>

I would set this at the database + schema level, so if the field is not present upon creation, it will use that value.

For example:

- In your schema: `field :score, :integer, default: 100, null: false`
- In your DB migration: `add(:score, :integer, default: 100, null: false)`

If you don’t want users to be able to adjust it during sign up or in other forms, then in your changeset you wouldn’t put `score` in your list of casted attributes.

---

_[View the full topic](https://forum.elixirforum.com/t/phoenix-form-default-values/22813)._
