diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java
index d2fb4b4c1a..41c97c3124 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImpl.java
@@ -110,11 +110,6 @@ public String getAltText() {
return translate("altText", altText);
}
- @Override
- public String getDataRef() {
- return null;
- }
-
@Override
@JsonIgnore
public String getDescription() {
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java
index 0eb7c57208..1005598af3 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/StaticImageImplTest.java
@@ -95,7 +95,7 @@ void testGetName() {
@Test
void testGetDataRef() {
StaticImage staticImage = Utils.getComponentUnderTest(PATH_IMAGE_CUSTOMIZED, StaticImage.class, context);
- assertEquals(null, staticImage.getDataRef());
+ assertEquals("a.b", staticImage.getDataRef());
StaticImage staticImageMock = Mockito.mock(StaticImage.class);
Mockito.when(staticImageMock.getDataRef()).thenCallRealMethod();
assertEquals(null, staticImageMock.getDataRef());
diff --git a/bundles/af-core/src/test/resources/form/image/exporter-image-customized.json b/bundles/af-core/src/test/resources/form/image/exporter-image-customized.json
index 3c40eef319..61d573feb0 100644
--- a/bundles/af-core/src/test/resources/form/image/exporter-image-customized.json
+++ b/bundles/af-core/src/test/resources/form/image/exporter-image-customized.json
@@ -1,5 +1,6 @@
{
"id": "image-ad1e095fba",
+ "dataRef" : "a.b",
"fieldType": "image",
"name": "abc",
"value": "/content/image-customized.img.png",
diff --git a/bundles/af-core/src/test/resources/form/image/test-content.json b/bundles/af-core/src/test/resources/form/image/test-content.json
index 3e7f023ea4..46cbd85af4 100644
--- a/bundles/af-core/src/test/resources/form/image/test-content.json
+++ b/bundles/af-core/src/test/resources/form/image/test-content.json
@@ -18,6 +18,7 @@
"jcr:title" : "def",
"hideTitle" : false,
"visible" : false,
+ "dataRef" : "a.b",
"altText": "abc",
"file": {
"jcr:content": {
diff --git a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js
index 4b85bed41a..3d0d0b300c 100644
--- a/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js
+++ b/it/apps/src/main/content/jcr_root/apps/forms-core-components-it/clientlibs/clientlib-it-custom-function/js/functions.js
@@ -175,6 +175,16 @@ function testTextImportData(globals)
globals.functions.importData({'a' : {'b' : 'prefilled'}});
}
+/**
+ * Tests static image import data
+ * @name testImageImportData
+ * @param {scope} globals
+ */
+function testImageImportData(globals)
+{
+ globals.functions.importData({'a' : {'b' : '/content/dam/reference-fragments/visa%402x.png'}})
+}
+
/**
* Tests set focus
* @name testSetFocus
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/image/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/image/basic/.content.xml
index 1e67ca00be..4ee2919200 100644
--- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/image/basic/.content.xml
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/image/basic/.content.xml
@@ -1,44 +1,82 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+Thank you for submitting the form.</p>
"
+thankYouOption="page">
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/image/v1/image/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/image/v1/image/_cq_dialog/.content.xml
index 4a2797e871..cd94e6d75f 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/image/v1/image/_cq_dialog/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/image/v1/image/_cq_dialog/.content.xml
@@ -44,9 +44,6 @@
-
{
diff --git a/ui.tests/test-module/specs/image/image.authoring.cy.js b/ui.tests/test-module/specs/image/image.authoring.cy.js
index 84161cef4d..349de5b1a1 100644
--- a/ui.tests/test-module/specs/image/image.authoring.cy.js
+++ b/ui.tests/test-module/specs/image/image.authoring.cy.js
@@ -58,7 +58,7 @@ describe('Page - Authoring', function () {
cy.get("[name='./name']")
.should("exist");
cy.get("[name='./dataRef']")
- .should("not.exist");
+ .should("exist");
cy.get("[name='./readOnly']")
.should("not.exist");
cy.get("[name='./unboundFormElement']")
diff --git a/ui.tests/test-module/specs/image/image.runtime.cy.js b/ui.tests/test-module/specs/image/image.runtime.cy.js
index 6ffc5a83cd..d6fd6b8e7f 100644
--- a/ui.tests/test-module/specs/image/image.runtime.cy.js
+++ b/ui.tests/test-module/specs/image/image.runtime.cy.js
@@ -91,4 +91,14 @@
})
+ it("prefill test", () => {
+ const [id, fieldView] = Object.entries(formContainer._fields)[3];
+ const [buttonId, buttonFieldView] = Object.entries(formContainer._fields)[1];
+ const model = formContainer._model.getElement(id);
+ cy.get(`#${buttonId}-widget`).should("be.visible").click().then(() => {
+ expect(model.value).contains("/content/dam/reference-fragments/visa%402x.png");
+ cy.get(`#${id}`).find('img.cmp-image__image').should('have.attr', 'src', '/content/dam/reference-fragments/visa%402x.png');
+ })
+ })
+
})
\ No newline at end of file