Skip to content

Commit 4e6ecee

Browse files
Merge branch 'development' into 983366-avatar
2 parents 0380cec + b35207a commit 4e6ecee

36 files changed

+660
-1018
lines changed

blazor-toc.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,9 +4262,6 @@
42624262
<li>Getting Started
42634263
<ul>
42644264
<li> <a href="/blazor/smart-paste/getting-started-webapp">Blazor Web App</a></li>
4265-
<li>
4266-
<a href="/blazor/smart-paste/getting-started">Blazor Server App</a>
4267-
</li>
42684265
</ul>
42694266
</li>
42704267
<li><a href="/blazor/smart-paste/annotation">Annotation</a></li>

blazor/smart-paste/annotation.md

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
22
layout: post
3-
title: Annotaions in Blazor Smart Paste Button Component | Syncfusion
4-
description: Checkout and learn here about Annotaions in Syncfusion Blazor Smart Paste Button component and much more.
3+
title: Annotations in Blazor Smart Paste Button Component | Syncfusion
4+
description: Learn how to use annotations with the Syncfusion Blazor Smart Paste Button component for precise AI-driven form field parsing.
55
platform: Blazor
66
control: Smart Paste Button
77
documentation: ug
88
---
99

1010
# Annotations in Blazor Smart Paste Button Component
1111

12-
## Annotating form fields
12+
The Syncfusion Blazor Smart Paste Button component leverages AI to intelligently parse clipboard content and populate form fields, enhancing user productivity. By default, the component analyzes form fields (e.g., `<input>`, `<select>`, `<textarea>`) using associated `<label>`, `name`, `id`, or adjacent text to generate descriptions for the AI model (OpenAI or Azure OpenAI). These descriptions guide the AI in mapping clipboard data to the correct fields. For greater control, you can override this behavior by using the `data-smartpaste-description` attribute to provide custom instructions for specific fields, ensuring precise data parsing (e.g., enforcing a date format).
1313

14-
By default, the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor `Smart Paste Button` analyzes form fields like `<input>`, `<select>`, and `<textarea>` elements, generating descriptions based on their associated `<label>`, `name` attribute, `id` attribute or nearby text content. These descriptions are then sent to the back end AI model to assist in accurately pasting the relevant data. However, for more control, you can override the default behavior by specifying custom descriptions for specific input field using the `data-smartpaste-description` attribute.
14+
## Annotating Form Fields
1515

16-
```cshtml
16+
Use the `data-smartpaste-description` attribute to provide custom instructions for specific form fields, overriding the default AI-generated descriptions. This is particularly useful for fields requiring specific formats, such as dates or custom data types. The example below demonstrates annotating a Date of Birth field to enforce a `DD-MM-YYYY` format within a `SfDataForm`, which maps form fields to clipboard data processed by the AI.
17+
18+
```razor
1719
@using Syncfusion.Blazor.DataForm
18-
@using System.ComponentModel.DataAnnotations
1920
@using Syncfusion.Blazor.SmartComponents
2021
@using Syncfusion.Blazor.Inputs
22+
@using System.ComponentModel.DataAnnotations
2123
22-
<SfDataForm ID="MyForm"
23-
Model="@EventRegistrationModel">
24+
<SfDataForm ID="MyForm" Model="@EventRegistrationModel">
2425
<FormValidator>
2526
<DataAnnotationsValidator></DataAnnotationsValidator>
2627
</FormValidator>
@@ -29,30 +30,28 @@ By default, the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor `Smart P
2930
<FormItem Field="@nameof(EventRegistration.DateOfBirth)">
3031
<Template>
3132
<label class="e-form-label">Date of Birth</label>
32-
<SfTextBox HtmlAttributes="DateOfBirth"
33-
ID="dateofbirth" />
33+
<SfTextBox HtmlAttributes="@DateOfBirth" ID="dateofbirth" />
3434
</Template>
3535
</FormItem>
3636
<FormItem Field="@nameof(EventRegistration.Email)" ID="email"></FormItem>
3737
<FormItem Field="@nameof(EventRegistration.Phone)" ID="phonenumber"></FormItem>
3838
<FormItem Field="@nameof(EventRegistration.Address)" ID="address"></FormItem>
3939
</FormItems>
4040
<FormButtons>
41-
<SfSmartPasteButton IsPrimary="true" Content="Smart Paste" IconCss="e-icons e-paste">
42-
</SfSmartPasteButton>
41+
<SfSmartPasteButton IsPrimary="true" Content="Smart Paste" IconCss="e-icons e-paste"></SfSmartPasteButton>
4342
</FormButtons>
4443
</SfDataForm>
4544
4645
<br>
47-
<h4 style="text-align:center;">Sample content</h4>
46+
<h4 style="text-align:center;">Sample Content</h4>
4847
<div>
4948
Hi, my name is Jane Smith. You can reach me at [email protected] or call me at +1-555-987-6543. I live at 789 Pine Avenue, Suite 12, Los Angeles, CA 90001. I was born on 15th March 1990.
5049
</div>
5150
5251
@code {
53-
private EventRegistration EventRegistrationModel = new EventRegistration();
52+
private EventRegistration EventRegistrationModel = new();
5453
55-
Dictionary<string, object> DateOfBirth = new Dictionary<string, object>()
54+
private Dictionary<string, object> DateOfBirth = new()
5655
{
5756
{ "data-smartpaste-description", "Date must follow the format: DD-MM-YYYY" }
5857
};
@@ -75,7 +74,7 @@ By default, the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor `Smart P
7574
[Display(Name = "Address")]
7675
public string Address { get; set; }
7776
78-
[Required(ErrorMessage = "Please enter your DOB.")]
77+
[Required(ErrorMessage = "Please enter your date of birth.")]
7978
[Display(Name = "Date Of Birth")]
8079
public string DateOfBirth { get; set; }
8180
}
@@ -84,11 +83,27 @@ By default, the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor `Smart P
8483

8584
N> In this example, the [Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataForm](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app) component is used to manage form input fields. To get started, ensure you have the [Syncfusion.Blazor.DataForm](https://www.nuget.org/packages/Syncfusion.Blazor.DataForm) package installed.
8685

87-
![Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart paste button with annotation](images/smart-paste-annotation.gif)
86+
## Run and Test the Application
87+
88+
1. Configure the Blazor Web App with the Smart Paste Button and AI services as described in the [Getting Started Guide](https://blazor.syncfusion.com/documentation/smart-paste/getting-started-webapp).
89+
2. Add the code above to **~/Pages/Home.razor**.
90+
3. Run the application using <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS).
91+
4. Copy the sample content provided in the Razor file.
92+
5. Click the **Smart Paste** button to verify that the form fields, including the Date of Birth, are populated correctly (e.g., `15-03-1990` for the Date of Birth).
93+
94+
![Syncfusion Blazor Smart Paste Button with Annotation](images/smart-paste-annotation.gif)
8895

8996
N> [View Sample in GitHub](https://github.com/syncfusion/smart-ai-samples).
9097

91-
## See also
98+
## Troubleshooting
99+
100+
If the annotation feature does not work as expected, try the following:
101+
- **Fields Not Populating Correctly**: Verify that the `data-smartpaste-description` attribute is correctly applied in the `HtmlAttributes` dictionary and matches the field’s requirements.
102+
- **AI Parsing Errors**: Ensure the AI service (OpenAI or Azure OpenAI) is configured correctly in **Program.cs** with valid credentials and model/deployment names.
103+
- **Form Rendering Issues**: Confirm that `Syncfusion.Blazor.DataForm` and `Syncfusion.Blazor.Inputs` packages are installed, and the Syncfusion Blazor service is registered in **Program.cs**.
104+
- **Dependency Issues**: Run `dotnet restore` to ensure all NuGet packages (`Syncfusion.Blazor.SmartComponents`, `Syncfusion.Blazor.Themes`, `Syncfusion.Blazor.DataForm`, `Syncfusion.Blazor.Inputs`) are installed.
105+
106+
## See Also
92107

93-
* [Getting Started with Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button in Blazor Web App](https://blazor.syncfusion.com/documentation/)
94-
* [Getting Started with Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button in Blazor Server App](https://blazor.syncfusion.com/documentation/)
108+
- [Getting Started with Syncfusion Blazor Smart Paste Button in Blazor Web App](https://blazor.syncfusion.com/documentation/smart-paste/getting-started-webapp)
109+
- [Syncfusion Blazor DataForm Documentation](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app)
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
---
22
layout: post
33
title: Customization in Blazor Smart Paste Button Component | Syncfusion
4-
description: Checkout and learn here all about Styles and Appearances in Syncfusion Blazor Smart Paste Button component and more.
4+
description: Explore styles and appearance customization options in the Syncfusion Blazor Smart Paste Button component.
55
platform: Blazor
66
control: Smart Paste Button
77
documentation: ug
88
---
99

1010
# Types and Appearance
1111

12-
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button component fully inherits all the properties, types, and styling options of the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Button component. This means that you can leverage the existing features of the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Button while benefiting from the enhanced functionality of the Smart Paste Button.
12+
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button component inherits all properties, types, and styling options of the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Button component. This allows users to utilize the existing features and flexibility of the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Button while taking advantage of the enhanced Smart Paste Button functionality.
1313

14-
* [Types and Styles](https://blazor.syncfusion.com/documentation/button/types-and-styles)
15-
* [Appearances](https://blazor.syncfusion.com/documentation/button/style-and-appearance)
14+
- [Types and Styles](https://blazor.syncfusion.com/documentation/button/types-and-styles)
15+
- [Style and Appearance](https://blazor.syncfusion.com/documentation/button/style-and-appearance)
1616

17-
## See also
17+
## See Also
1818

19-
* [Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Button Types and Styles](https://blazor.syncfusion.com/documentation/button/types-and-styles)
20-
* [Getting Started with Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button in Blazor Web App](https://blazor.syncfusion.com/documentation/)
21-
* [Getting Started with Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Smart Paste Button in Blazor Server App](https://blazor.syncfusion.com/documentation/)
19+
- [Blazor Button Component: Types and Styles](https://blazor.syncfusion.com/documentation/button/types-and-styles)
20+
- [Getting Started with Blazor Smart Paste Button in Web App](https://blazor.syncfusion.com/documentation/smart-paste/getting-started-webapp)

0 commit comments

Comments
 (0)