Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Sample | Create/upload DAM assets from Adaptive forms

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

310 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

310 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

08-04-2021

Hello Community,

 

It has been a while that I posted something here.

 

A lot of people want to leverage form with DAM assets. Simple example, you have an adaptive form and you want user to upload the image but instead of saving it in some other system you want to leverage DAM assets.

 

Two main things for such use case:

  •  DAM has a very exhaustive set of HTTP API that can help you create folders and assets.
  •  Form fields have a lot of events on which you can trigger the HTTP API and POST the form data to DAM.

 

Sample:

 

Create a simple html widget for file upload.

 

<p>Image</p>
<p><input id="default_file" type="file" name="logo">&nbsp;<button id="clear">clear</button></p>

 

Create JS to handle file upload and ingest the payload to DAM API.

 

$('#default_file').change(function(){
//on change event
formdata = new FormData();
if($(this).prop('files').length > 0)
{
file =$(this).prop('files')[0];
formdata.append("file", file);
formdata.append("name", "yourLogoName.jpeg");
}

jQuery.ajax({
url: "http://localhost:4502/api/assets/test/*",
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (result) {
alert("all is well");
},error: function(){alert("some err occurred");}
});

});

 

Thanks,

Mayank Gandhi

Connect with me over LinkedIn

 

 

 

 

Adaptive Forms DAM Assets

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,162 likes

Total Posts

6,273 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,162 likes

Total Posts

6,273 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

11-04-2021

@Mayank_Gandhi Thank you for sharing this with AEM community. And Good to see you back. Encourage your peers to also contribute to the AEM Community.