Expand my Community achievements bar.

SOLVED

How to populate multi field data on click "Add" button ?

Avatar

Level 2

Hi

I need to pre-populate the data when user click on "Add" button  in touch UI page properties. How to show by default two fields with pre-populate content?(Without click click on Add button)

In page properties we are using wizard (not dialog)

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Then you need to write Javascript to autofill data on click event of add button.

category can be use for clientlibs "cq.siteadmin.admin.properties"

Example

Tryit Editor v3.5

For example on content load you can manipulate DOM and add multiplied items by adding <li>

(function(document, Granite, $) {

  "use strict";


$(document).on("foundation-contentloaded", function(e) {
// code to create multiplfield item on load and set dynamic values
});
})(document, Granite, Granite.$);

Example - Lets say for vanity urls you need to add 2 vanity url on page load, you can add 2 li element as child of ol with the like below HTML snippet

Screen Shot 2018-09-04 at 11.29.19 AM.png



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

You can set default value using value property.

TextField — Granite UI 1.0 documentation



Arun Patidar

Avatar

Level 2

Hi Arun,

I need to populate dynamic data into fields, in the above case we could see same value every time when user click on "Add"

Avatar

Correct answer by
Community Advisor

Hi,

Then you need to write Javascript to autofill data on click event of add button.

category can be use for clientlibs "cq.siteadmin.admin.properties"

Example

Tryit Editor v3.5

For example on content load you can manipulate DOM and add multiplied items by adding <li>

(function(document, Granite, $) {

  "use strict";


$(document).on("foundation-contentloaded", function(e) {
// code to create multiplfield item on load and set dynamic values
});
})(document, Granite, Granite.$);

Example - Lets say for vanity urls you need to add 2 vanity url on page load, you can add 2 li element as child of ol with the like below HTML snippet

Screen Shot 2018-09-04 at 11.29.19 AM.png



Arun Patidar