Pre populate data in touch ui dialog on click of multifield add button | Community
Skip to main content
Level 3
November 19, 2021

Pre populate data in touch ui dialog on click of multifield add button

  • November 19, 2021
  • 1 reply
  • 1206 views

Hi All,

 

I have a requirement where i have to pre populate a field inside multifield everytime "add" button is clicked. any guidance is appreciated

 

TIA

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

1 reply

Asutosh_Jena_
Community Advisor
Community Advisor
November 19, 2021

Hi @annkitaaggarwal 

 

You can write a simple on click event which can be triggered when someone clicks on the "Add" button in multifield. But what value it should populate? Where should we get this value?

Level 3
November 19, 2021

i need to specify id there, where author can copy and use it to link if needed. can you please help me with a code snippet

Asutosh_Jena_
Community Advisor
Community Advisor
November 19, 2021

Hi @annkitaaggarwal 

 

Please make sure your multifield node has the granite:class property with class name as "multifield-click" as the same class is referred in code.

 

 

Here is a sample code:

 

(function ($, $document) {
"use strict";

$document.on("dialog-ready", function () {

$(".multifield-click .coral3-Button--secondary").click(function(){
alert((Math.random().toString(36).substr(2, 9))); // Take this id and append in the input field where necessary.
})

});

})($, $(document));