# validateFields()

> The validateFields() method is used to verify whether the form fields under the currently selected payment method are complete and properly formatted. This method automatically identifies and validates the required parameters based on the selected payment method, eliminating the need for developers to manually maintain the parameter list.

The `validateFields()` method is used to verify whether the form fields under the currently selected payment method are complete and properly formatted. This method automatically identifies and validates the required parameters based on the selected payment method, eliminating the need for developers to manually maintain the parameter list.

Even if `validateFields()` is not explicitly called, when executing [`submitPayment()`](https://docs.antom.com/ac/sdks/web_submitPayment.md), the component will automatically display the corresponding error messages if any form issues are detected. The purpose of providing the `validateFields()` method is to allow developers to perform custom validation processes or business logic before submission.

## **Method signature**

When calling this method, please use the following standard method signature format.

#### Tab: JavaScript

```javascript
validateFields()
```

#### Tab: TypeScript

```typescript
validateFields(): Promise<{ isValid: boolean }>
```

## Parameters

This method takes no input parameters. The `validateFields()` method automatically validates all required parameters based on the selected payment method.

## Return values

Returns a `Promise` object that resolves to an object containing the validation results.

| **Parameter** | **Data type** | **Description** |
| --- | --- | --- |
| _isValid_ | Boolean | Indicates whether all parameters pass validation. Valid values are:<br/><br/>- `true`: Validation passed.<br/>- `false`: Errors exist. |