# When I fill out a form and I enter the required fields but not the optional fields, after validation the optional fields are filled with 1

**URL:** <https://community.forestadmin.com/t/when-i-fill-out-a-form-and-i-enter-the-required-fields-but-not-the-optional-fields-after-validation-the-optional-fields-are-filled-with-1/8330>\
**Category:** Help me!\
**Created:** [October 7, 2025, 3:14pm UTC](https://community.forestadmin.com/t/when-i-fill-out-a-form-and-i-enter-the-required-fields-but-not-the-optional-fields-after-validation-the-optional-fields-are-filled-with-1/8330 "2025-10-07T15:14:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soufiane](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@Soufiane](https://community.forestadmin.com/u/Soufiane)\
**Post date:** [October 7, 2025, 3:14pm UTC](https://community.forestadmin.com/t/when-i-fill-out-a-form-and-i-enter-the-required-fields-but-not-the-optional-fields-after-validation-the-optional-fields-are-filled-with-1/8330/1 "2025-10-07T15:14:30Z")

</div>

## Feature(s) impacted

## Observed behavior

## Expected behavior

quand je remplie un formulaire , et que je renseigne les champs obligatoires , et pas les chamaps facultatifs, apprès la validation les champs facultatifs sont remplis par des 1

```javascript
//Create a sageProviders
router.post('/sageProviders', permissionMiddlewareCreator.create(), (request, response) => {
  const recordSerializer = new RecordSerializer({ name: 'sageProviders' });
  const data = request.body.data.attributes;
  console.log("🚀 ~ data:", data)

  if (!regValidateSiret.test(data.siret)) {
    response.status(400).send('Le SIRET contient des espaces ou des caractères autres que numériques. Merci de corriger.');
  }
  const body = {
    matricule: '',
    mail: data.email,
    city: data.site_ville,
    street: data.street,
    company_name: data.raison_sociale,
    street_number: data.street_number,
    phone_number: data.telephone,
    siret: data.siret,
    zip_code: data.site_codepostal
  };

  axios.post(`${API_URL}/forest_admin/sage_create_provider`, body, {
    headers: {
      'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`,
      'X-CURRENT-USER-EMAIL': request.user.email
    },
  }).then(async postResponse => {
    console.log("🚀 ~ postResponse:", postResponse)
    response.send(
      await recordSerializer.serialize(
        {
          id: postResponse.data.fournisseur.matricule,
          ...postResponse.data.fournisseur
        }
      )
    );
  }).catch(err => {
    if (err.response?.data?.error?.message) {
      response.status(400).send(err.response.data.error.message);
    } else if (err.response?.data?.error) {
      response.status(400).send(err.response?.data?.error);
    } else {
      response.status(400).send('Erreur inattendue, veuillez contacter votre administrateur.');
    }
  });
});

```

voici mon code :

## Failure Logs

## Context

- Project name: .Sergic  
Team name: gestion  
Environment name: Développement  
Agent (forest package) name & version: 9  
Database type: Postgres  
Recent changes made on your end if any: any changes

**And, if you are self-hosting your agent:**

- Agent technology: (nodejs, php, ruby, python)
- Agent (forest package) name & version (from your .lock file): …

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [October 9, 2025, 1:22pm UTC](https://community.forestadmin.com/t/when-i-fill-out-a-form-and-i-enter-the-required-fields-but-not-the-optional-fields-after-validation-the-optional-fields-are-filled-with-1/8330/2 "2025-10-09T13:22:46Z")

</div>

Hi @Soufiane ,

I did not really understand when in your code the data is filled by ‘1’ ?

Best regards,

Shohan
