@availity/native-form
Version:
Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action.
56 lines (39 loc) • 1.75 kB
Markdown
> Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action.
[](https://www.npmjs.com/package/@availity/native-form)
[](https://www.npmjs.com/package/@availity/native-form)
[](https://github.com/Availity/sdk-js/blob/master/packages/native-form/package.json)
```bash
npm install @availity/native-form
```
```bash
yarn add @availity/native-form
```
Creates and submits a native HTML form to initiate SSO navigation to a space.
```js
import nativeForm from '@availity/native-form';
// Open a space via SSO with parameters
await nativeForm('space-id', { param1: 'value1' });
// With custom form attributes and explicit SSO type
await nativeForm(
'space-id',
{ payerId: '123' },
{ target: '_self' },
'saml',
'my-client-id'
);
```
| Parameter | Type | Description |
| --- | --- | --- |
| `spaceId` | string | **Required.** The space ID to navigate to |
| `params` | object | Key-value pairs submitted as hidden form fields |
| `formAttributes` | object | HTML form attributes (default: `{ method: 'post', target: '_blank' }`) |
| `type` | string | SSO type (`'saml'` or `'openid'`). Auto-detected if not provided |
| `clientId` | string | Client ID for the API request (default: `'clientId'`) |
## Documentation
Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/native-form)