How to validate the attached file is jpg on ui builder experience and show pop up if it is not jpg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 04:55 AM
Hi ,
I have below requirement,
I created a variable of type attachment, and variable attributes I have added add extension =jpg.
when I am attaching the file other jpg it was not attaching, if it is jpg it is allowing to attach.
I want an error message when a user attach other than jpg.
how to validate this on ui builder experience?
- Labels:
-
UI Builder : Next Experience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 05:00 AM
Hello @sony8
const file = this.files[0];
const fileType = file['type'];
const validImageTypes = [ 'image/jpg'];
if (!validImageTypes.includes(fileType)) {
// invalid file type code goes here.
alert('your popup message')
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 05:03 AM
@Samaksh Wani I need to write onchange client script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 05:03 AM
Hello @sony8
Yes you can write on change client script.
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 05:05 AM
Hello @sony8
Also you will be having one more approach.
You can go to variable > In Variable Attribute.
allowed_extension=jpg
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh