Ticket T1285455
Visible to All Users

Activate sending button in dx-chat

created 4 days ago (modified 4 days ago)

Hi, how to programatically enable send button on dx-chat component? I need to pre-populate text area with text from typescript code. And then enable the button so user could click and send the pre-populated message.

I managed to input example text like so

TypeScript
constructor(private elRef: ElementRef) { //omitted code } //omitted code onClick(exampleText){ let chatTextArea = this.elRef.nativeElement.querySelectorAll('.dx-texteditor-input'); chatTextArea[0].innerText = exampleText; }

But how do I enable the button so user could click send button and send the message?

Answers approved by DevExpress Support

created 3 days ago

Hello,

Use the "#CHAT_ID .dx-chat-messagebox-button" selector to get the Chat button instance. Please follow recommendations from this help topic: Change Component Properties and Handle Events. Then, use the button instance to set the disabled option to false with the option method.

Let me know if this helps.

Regards,
Assylbek

    Comments (3)

      Hi Assylbek, thank you for pointing out to these helpful resources. With your help I got the button enabled once the text is filled. Unfortunately clicking button does nothing and gives no error. After entering any character to the text box, then it allows me to click send.

      Would you be able to assist me how to get this working. I'm assuming there is something else triggered/enabled that allows the message to be sent.

      A A
      Assylbek (DevExpress Support) 2 days ago

        Hello,

        In this case, use a similar approach to update the value of the Chat TextArea directly. This update will trigger the valueChanged event, allowing you to send the required text immediately.

        Use the "#CHAT_ID .dx-chat-messagebox-textarea" selector to get a Chat TextArea instance. Then, use this instance to set the value option to exampleText with the option("value", exampleText) method.

        Let me know if this helps.

        Regards,
        Assylbek

          Hi, yes this worked, thank you so much for the help!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.