Touch UI dialog | Community
Skip to main content
October 5, 2022
Solved

Touch UI dialog

  • October 5, 2022
  • 2 replies
  • 1107 views

In Component I have three fields, Image height and Image width in one tab and dropdown in another tab and dropdown has options like left, center, right and inline. If author mentions the value of image height and image width then in dropdown inline option should get automatically applied. 

 

 

 

 

 

 

Thanks & Regards,

Vineetha Kolipaka.

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 Aditya_Chabuku

Hi @vineethakolipaka , 

 

As Arun said, you have to write JS on your dialog to change field values based on author inputs.

Write something like this based on your requirements. 

 

 

(function ($, $document, Coral) {
    var selectfield = {};
    $document.on("dialog-ready", function () {

        selectdata = [];
        const form = document.querySelector('form.cq-dialog');

        init();

        /*Start of Functions**/
        function init() {
            try {
                selectfield.actionPath = form.action;
                 // console.log(selectfield.actionPath);
                processData();
            } catch (err) {
                 // console.log(err.message + ', Component not available');
            }
        }

        function processData() {
            $.ajax({
                url: `/bin/design_dialog?path=${form.action}`,
                async: false,
                dataType: 'json',
                success: function (data) {
                    selectdata = data.groups;
                    readInputValues(selectdata);
                }
            });
        }
function readInputValues(selectdata) {
/*Write your own logic as required*/.
setDropDownValue(data);
}


function setDropDownValue(data) { /*Write your own logic as required*/. } // then apply your desired output values back into dialog $(document).on("click", ".cq-dialog-submit", function (e) { /* proces & apply your data here*/ }); $('input[data-class^="**youridentifier**"]').change(function () { /* change selector values*/ }); })($, $(document), Coral);

 

 

Regards,
Aditya.Ch

2 replies

arunpatidar
Community Advisor
Community Advisor
October 5, 2022

Hi,

You need to write javascript event listener to set the dropdown values.

check javascript logic at https://stackoverflow.com/questions/36850805/change-dropdown-values-based-on-input-in-textfield  

Arun Patidar
Aditya_Chabuku
Community Advisor
Aditya_ChabukuCommunity AdvisorAccepted solution
Community Advisor
October 5, 2022

Hi @vineethakolipaka , 

 

As Arun said, you have to write JS on your dialog to change field values based on author inputs.

Write something like this based on your requirements. 

 

 

(function ($, $document, Coral) {
    var selectfield = {};
    $document.on("dialog-ready", function () {

        selectdata = [];
        const form = document.querySelector('form.cq-dialog');

        init();

        /*Start of Functions**/
        function init() {
            try {
                selectfield.actionPath = form.action;
                 // console.log(selectfield.actionPath);
                processData();
            } catch (err) {
                 // console.log(err.message + ', Component not available');
            }
        }

        function processData() {
            $.ajax({
                url: `/bin/design_dialog?path=${form.action}`,
                async: false,
                dataType: 'json',
                success: function (data) {
                    selectdata = data.groups;
                    readInputValues(selectdata);
                }
            });
        }
function readInputValues(selectdata) {
/*Write your own logic as required*/.
setDropDownValue(data);
}


function setDropDownValue(data) { /*Write your own logic as required*/. } // then apply your desired output values back into dialog $(document).on("click", ".cq-dialog-submit", function (e) { /* proces & apply your data here*/ }); $('input[data-class^="**youridentifier**"]').change(function () { /* change selector values*/ }); })($, $(document), Coral);

 

 

Regards,
Aditya.Ch

Thanks,Aditya Chabuku