1

I have a custom dialog with a button and an input on it. On the click event of the button I want to trigger the OnChange function of the input. I don't know how to get the sibling UIElement of the current one.

Here is an example of my code:

{
    id : 'txtUrl',
    type : 'text',
    label : 'My input',
    onChange : function() {
      alert('content changed')
    }
}
{
    type : 'button',
    align : 'center',
    label : 'My Button',
    onClick : function() {
      // execute the input.onChange()
      ?????
    }
}
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Givius
  • 1,008
  • 8
  • 12

1 Answers1

1

I just find out (another developer showed to me), and here go answer:

{
    id : 'info',
    label : 'my container',
    elements :
    [
    {
        id : 'txtUrl',
        type : 'text',
        label : 'My input',
        onChange : function() {
           alert('content changed')
        }
    }
    {
        type : 'button',
        align : 'center',
        label : 'My Button',
        onClick : function() {
           this.getDialog().getContentElement("info", "txtUrl").onChange();
        }
    }
    ]
}
Givius
  • 1,008
  • 8
  • 12