JavaScript/jQuery Form - SimpleItem.aiOptions
Specifies options for an AI service that parses Smart Paste data.
Type:
Use options available in this class to customize how an AI Service processes data. You can apply the following changes:
- Mark a field as disabled for AI processing.
- Specify custom parsing instructions for a field.
The following code snippet adds a custom instruction to the item:
jQuery
index.js
$("#form").dxForm({
// ...
items: [
{
dataField: 'Email',
editorType: 'dxTextBox',
validationRules: [{ type: 'email' }],
aiOptions: {
instruction: 'Do not fill this field if the text contains an invalid email address. A valid email is in the following format: email@example.com',
},
}
]
});Angular
app.component.html
app.component.ts
<dx-form ... >
<dxi-form-item
dataField="Email"
editorType="dxTextBox"
[aiOptions]="emailAIOptions"
>
<dxi-form-validation-rule type="email"></dxi-form-validation-rule>
</dxi-form-item>
</dx-form>
// ...
export class AppComponent {
emailAIOptions = { instruction: 'Do not fill this field if the text contains an invalid email address. A valid email is in the following format: email@example.com' };
}Vue
App.vue
<template>
<DxForm ... >
<DxItem
data-field="Email"
editor-type="dxTextBox"
:ai-options="emailAIOptions"
:validation-rules="emailValidationRules"
/>
</DxForm>
</template>
<script setup lang="ts">
import { DxForm, DxItem } from 'devextreme-vue/form';
import type { ValidationRule } from 'devextreme-vue/common';
// ...
const emailValidationRules: ValidationRule[] = [{ type: 'email' }];
const emailAIOptions = { instruction: 'Do not fill this field if the text contains an invalid email address. A valid email is in the following format: email@example.com' };
</script>React
App.tsx
import React from 'react';
import Form, {
Item,
} from 'devextreme-react/form';
import type { ValidationRule } from 'devextreme-react/common';
// ...
const emailValidationRules: ValidationRule[] = [{ type: 'email' }];
const emailAIOptions = { instruction: 'Do not fill this field if the text contains an invalid email address. A valid email is in the following format: email@example.com' };
const App = () => {
return (
<Form ... >
<Item
dataField="Email"
editorType="dxTextBox"
aiOptions={emailAIOptions}
validationRules={emailValidationRules}
/>
</Form>
);
}instruction
Specifies an individual item instruction for the AI service.
Type:
| undefined
Default Value: undefined
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.