# Bug OP-14610 - Default value is not saved on custom field creation, only on update

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-14610

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 14.4.0 |
| Observed in versions | 13.4.0 |
| Sprint | 14.4.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 13.4.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Ivan Kuchin |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Login as an admin
2.  Go to the administration page, and then the custom fields page
3.  Click on &quot;+ Custom Field&quot;
4.  Provide a name, pick whatever type (e.g. string) and enter a default value
5.  Click on &quot;Save&quot;

### What is the buggy behavior?

*   The created custom field does not have a default value
*   You need to update the created custom field and provide the default value again in order for it to be saved properly

### What is the expected behavior?

*   The default value should be saved properly on initial creation already

### Environment information

**OpenProject installation type**

Dev env on localhost

**OpenProject version**

_current DEV branch (&gt;13.4)_

**Browser**

Chrome

**Language**

_English_

## Notes

My best guess on based what I saw so far: The reason for this issue can be found in the dynamic nature of this form. It provides multiple different default\_value input forms, which are just hidden by a stimulus controller whenever a different custom field type is selected. The form submits ALL of them, which causes the server to pick just the last one, which in most cases is empty. This only happens within the creation form as the type is not persisted yet. The update form does not have to provide different default\_value inputs, as the type cannot be changed anymore, thus the update with a provided default value works.
