# Save custom field value from edit topic area?

**URL:** https://meta.discourse.org/t/save-custom-field-value-from-edit-topic-area/207069
**Category:** Development
**Created:** [October 25, 2021, 10:53pm UTC](https://meta.discourse.org/t/save-custom-field-value-from-edit-topic-area/207069 "2021-10-25T22:53:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [October 25, 2021, 10:53pm UTC](https://meta.discourse.org/t/save-custom-field-value-from-edit-topic-area/207069/1 "2021-10-25T22:53:17Z")

</div>

Hi There. Using the code that @angus has laid out [here](https://meta.discourse.org/t/how-to-add-custom-fields-to-models/184485), and following the [github repo](https://github.com/pavilionedu/discourse-topic-custom-fields), I’m able to get the topic custom field working well– **except for enabling it to be edited in the “header” area of the composer** (where you normally are able to edit the category, for instance; ie, in the **edit-topic connector** ).

I’ve followed the code for this in the repo, including the code at plugin.rb and elsewhere. For instance, I’ve added the input in the file connectors/edit-topic/edit-topic-custom-field-container.hbs (like [here](https://github.com/pavilionedu/discourse-topic-custom-fields/blob/master/assets/javascripts/discourse/connectors/edit-topic/edit-topic-custom-field-container.hbs)):

```plaintext
{{#if isString}}
  {{input
    type="text"
    value=(readonly fieldValue)
    class="topic-custom-field-input large"
    input=(action "onChangeField" value="target.value")
    placeholder=(i18n 'topic_custom_field.placeholder' field=fieldName)
  }}
{{/if}}

```

And then also the code in the [topic-custom-field-initializer](https://github.com/pavilionedu/discourse-topic-custom-fields/blob/master/assets/javascripts/discourse/initializers/topic-custom-field-initializer.js.es6), like this:

```plaintext
api.registerConnectorClass('edit-topic', 'edit-topic-custom-field-container', {
        setupComponent(attrs, component) {
          const model = attrs.model;
          
          let props = {
            fieldName: fieldName,
            fieldValue: model.get(fieldName)
          }
          component.setProperties(Object.assign(props, fieldInputTypes(fieldType)));
        },
        
        actions: {
          onChangeField(fieldValue) {
            this.set(`buffered.${fieldName}`, fieldValue);
          }
        }
      });

... 
  api.serializeOnCreate(fieldName);
      api.serializeToDraft(fieldName);
      api.serializeToTopic(fieldName, `topic.${fieldName}`);

```

But: while the other repo code works for me (like adding the custom field value in the composer value), and I get no errors, I am not able to **save** the value I enter in the edit-topic connector input. If I enter a value there, the value disappears after the edit is saved.

Is it possible that something else is required for saving the value in the edit-topic connector?
