> For the complete documentation index, see [llms.txt](https://docs.gapvelocity.ai/webmap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gapvelocity.ai/webmap/webforms/extend-or-modify-the-converted-application/adding-frontend-validator.md).

# Adding FrontEnd validator

WebForms has control [<mark style="color:red;">validators</mark>](https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.basevalidator?view=netframework-4.8), you can add a validator to a [<mark style="color:red;">newly added control</mark>](/webmap/winforms/extend-or-modify-the-converted-application/adding-a-component.md).

Let's say you want to add a required validator for a new textbox control.&#x20;

Add the required validator in the Frontend and set an unique id.

**myPage.html**

```typescript
<wm-required-field-validator id="rev1" [model]="model.rev1" class="rev1">
</wm-required-field-validator>
```

Then, you have to declare the validator in the Backend file.

**myPage.designer.cs**

```csharp
[Intercepted]
protected Mobilize.Web.UI.Controls.RequiredFieldValidator rev1 { get; set; }
```

In the same file you have to initialize and set the necessary properties in the `InitializeComponent` method

```csharp
this.rev2 = new Mobilize.Web.UI.Controls.RequiredFieldValidator();
this.rev2.Name = "rev1";
this.rev2.ControlToValidate = "Textbox2";
this.rev2.ErrorMessage = "Validator Error Message";
this.Controls.Add(this.rev2);
```

The `ControlToValidate` property must be the same as the `Control.Name` you want to validate. In the previous example we have a textbox with that name.

```csharp
this.TextBox2.Name = "Textbox2";
```

After these changes the new validator is ready.

![](https://4139013925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MEOm98BbzqckTUoLpXN%2Fuploads%2FYKAoLMDF21qF4dsPLytD%2Fimage.png?alt=media\&token=cc917cb6-b2b1-4a06-9107-5a07d08a0607)
