> 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.

![](/files/TS6XcKlX4307MZZb4qXH)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gapvelocity.ai/webmap/webforms/extend-or-modify-the-converted-application/adding-frontend-validator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
