# Help needs: Adding T&C checkbox to registration form is not working

**URL:** <https://forum.ionicframework.com/t/help-needs-adding-t-c-checkbox-to-registration-form-is-not-working/227964>\
**Category:** Ionic Angular\
**Created:** [October 24, 2022, 5:27pm UTC](https://forum.ionicframework.com/t/help-needs-adding-t-c-checkbox-to-registration-form-is-not-working/227964 "2022-10-24T17:27:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![faridsilva](https://avatars.discourse-cdn.com/v4/letter/f/e56c9b/32.png) [@faridsilva](https://forum.ionicframework.com/u/faridsilva)\
**Post date:** [October 24, 2022, 5:27pm UTC](https://forum.ionicframework.com/t/help-needs-adding-t-c-checkbox-to-registration-form-is-not-working/227964/1 "2022-10-24T17:27:12Z")

</div>

Hello, I a complete newbie to Ionic and I’m trying to help a friend who has a working ionic-angular app. the point is that he need to include a mandatory checkbox in registration form to accept _Terms and Conditions_ before register, as well as a link to download a pdf file with those _T&C_ from website.

I got the project on mi computer and using VSCode I found _register.component.html_, _register.component.scss_ and _register.component.ts_, which contains all related form and logic

In .html file I found a `<form>` tag with several fields needed to register a new user, like this one

```auto
<ion-item-group>
    <ion-item>
      <ion-label position="floating">Email</ion-label>
      <ion-input type="email" formControlName="email" required></ion-input>
    </ion-item>
    <ng-container *ngFor="let validation of email">
      <small class="error_message" *ngIf="
          form.get('email').hasError(validation.type) &&
          (form.get('email').dirty || form.get('email').touched)
        ">
        <ion-icon name="alert-outline"></ion-icon> {{ validation.message }}
      </small>
    </ng-container>
  </ion-item-group>

```

in .ts file I found a validation routine which is posted here:  
[https://codeshare.io/Wd96W8](https://codeshare.io/Wd96W8)

Later, I’ve added in .html file a checkbox and a link as:

```auto
  <ion-item-group>
    <ion-item>
      <ion-checkbox slot="start" formControlName="tyc" required></ion-checkbox>
      <ion-label >He leído y acepto los <a href="https://domain.com/tyc/tycs-22.2.22.pdf" target="_blank" class="text-warning">términos y condiciones de uso</a> del sistema.</ion-label>
    </ion-item>
    <ng-container *ngFor="let validation of validations.tyc">
      <small class="error_message" *ngIf="
    form.get('tyc').hasError(validation.type) &&
    (form.get('tyc').dirty || form.get('tyc').touched)
  ">
        <ion-icon name="alert-outline"></ion-icon> {{ validation.message }}
      </small>
    </ng-container>
  </ion-item-group>

```

The project was created using Ionic5 + Angular 10 and I facing two different kind of problems:

1. Running _ng serve_ command as stated in package.json I get a preview of the app in localhost:4200, navigating to registration form is working and it shows the added checkbox and label as expected.

 ![Screen Shot 2022-10-24 at 13.48.39](https://global.discourse-cdn.com/ionicframework/original/3X/f/3/f3b9f83235847d7f59ef4d17a295c1dfa3732684.png)

If I check the checkbox, registration form send its value to API, which is correct. But if I leave checkbox unchecked, it should fire an error because it is marked as _required_ and added to validations array. But this validation doesn’t occur, and this is the first problem  
(The same occurs when running ionic serve).

1. When trying to compile the application, I found that the checkbox is not there anymore.

![Screen Shot 2022-10-24 at 14.24.24](https://global.discourse-cdn.com/ionicframework/original/3X/5/7/571b0ce6488583b589addd2f4f363b577d75474e.png)

I’ve tried cleaning and removing www folder and then building again the project without success.

Any suggestion will be appreciated. Regards!
