Skip to content

PaForm

Form wrapper component that provides validation handling and submit management for PayAdvantage UI forms. Automatically validates all child form components before submission.

Interactive Example

Preferred Contact Method
Form Status:Invalid

Try filling out the form above to see validation in action. The form will only submit when all required fields are valid.

Basic Usage

vue
<template>
  <pa-form @submit="handleSubmit">
    <pa-input-group 
      label="Name" 
      v-model="form.name"
      required 
    />
    <pa-input-group 
      label="Email" 
      v-model="form.email"
      type="email"
      required 
    />
    <pa-button type="submit">Submit</pa-button>
  </pa-form>
</template>

<script setup>
import { ref } from 'vue'

const form = ref({
  name: '',
  email: ''
})

const handleSubmit = (event) => {
  console.log('Form submitted:', form.value)
  // Form is only submitted if all validation passes
}
</script>

Importing

typescript
import { PaForm } from '@payadvantage/ui-components'

Properties

PropertyTypeDefaultDescription
novalidatebooleanfalseDisables automatic form validation
validatedbooleanfalseShows validation state on all fields (for Bootstrap compatibility)

Events

EventPayloadDescription
submitEventEmitted when form is submitted and all validation passes
update:validityValidityChangedEventEmitted when form validation state changes

Methods

MethodDescription
checkValidity()Validates all form fields synchronously and returns boolean
checkValidityAsync()Validates all form fields (including async validators) and returns Promise<boolean>
resetValidity()Resets validation state of the form and all child components
submit()Programmatically submits the form

Usage Notes

PaForm automatically prevents form submission if any child form components fail validation. It integrates with PayAdvantage validation system and supports both synchronous and asynchronous validation rules.

The component wraps a standard HTML <form> element and passes through all standard form attributes.