Aikau textbox not being populated by subscription topic

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Aikau textbox not being populated by subscription topic

I'm working on an Aikau page for Alfresco Share containing a custom widget on one side and an Aikau form on the other.
I would like one of the form inputs to be populated by data obtained from clicking a button in the custom widget, so I declared my input with valueSubscriptionTopic like this:

var dateOfReportTextBox = {
  name: "alfresco/forms/controls/TextBox",
  config: {
    fieldId: "DATE_OF_REPORT",
    name: "cm:date-of-report",
    label: "Date of Report",
    placeHolder: "date",
    requirementConfig: {
      initialValue: false
    },
    valueSubscriptionTopic: "SET_DATE_OF_REPORT"
  }
};

In my custom widget code I attached an event handler to the button containing this line:

this.alfPublish("SET_DATE_OF_REPORT", "Testing", true); // true for global scope

But the input is not being populated. I verified that "this" refers to the custom widget. Am I misunderstanding the usage of valueSubscriptionTopic?

1 Reply
Highlighted
Master

Re: Aikau textbox not being populated by subscription topic

The payload of the publish should be an object with a value property, not a simple string. If you enable Aikau logging, you'll likely see a message stating "Attempt made to set form control value by subscription with an inapproriate payload"