How to populate multi field data on click "Add" button ? | Community
Skip to main content
nagasreenug4839
Level 2
September 4, 2018
Solved

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

  • September 4, 2018
  • 3 replies
  • 1805 views

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)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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

3 replies

arunpatidar
Community Advisor
Community Advisor
September 4, 2018

Hi,

You can set default value using value property.

TextField — Granite UI 1.0 documentation

Arun Patidar
nagasreenug4839
Level 2
September 4, 2018

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"

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 4, 2018

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

Arun Patidar