cancel
Showing results for 
Search instead for 
Did you mean: 

Aikau publishTopic

redraccoon
Star Contributor
Star Contributor

Hello, a quick question about the Topics in Aikau

when I click publish on a simple button it's working perfect

****************

aikau code : 

name: "alfresco/buttons/AlfButton",
config: {
   publishTopic: "REDRACCOON"
}

results in logs : 

Object {type: "PUBLICATION", topic: "REDRACCOON", payload: Object, publisherId: "alfresco_buttons_AlfButton___7b2f8a01-5fd4-473f-8d96-0d50763de145", publisher: Object}

****************

but now let's try in a simple form

****************

aikau code : 

name : "alfresco/forms/Form",
config : {
okButtonPublishTopic : "REDRACCOON",
widgets : [ ]

            }

results in logs : 

Object {type: "PUBLICATION", topic: "0a785910-a2a8-4b51-8988-edf6e9334b390a785910-a2a8-4b51-8988-edf6e9334b39REDRACCOON", payload: Object, publisherId: "uniqName_1_76", publisher: Object

****************

with the bad topic I can't intercept my payload 

I'm making this post because I often went trought this without understanding why sometimes the topic is changed like this ?

I remember having the same issue with topic on "_valueChangeOf_" before  but can't remember how I fixed and I really would like to get the mechanics 

Thank you

1 ACCEPTED ANSWER

redraccoon
Star Contributor
Star Contributor

a random prefix for the scope is generated to be shure that all of your widgets inside your form are saff and together, you can desactivate this option with 

scopeFormControls: true

Or better solution rename this random scope with pubSubScope

name : "alfresco/forms/Form",
config : {
pubSubScope : "fixedPrefixScope",

okButtonPublishTopic : "REDRACCOON",
widgets : [ ]

            }

View answer in original post

2 REPLIES 2

redraccoon
Star Contributor
Star Contributor

in the source I found this wich might be the solution, 

/** * Indicates that the a new pubSubScope should be generated for this widget so that it's * form controls will be scoped to only communicate with this instance and not "pollute" * any other forms that may also be on the page. * * @instance * @type {boolean} * @default */

scopeFormControls: true,

It's really usefull (without this scope I couldn't use  requirementConfig: {initialValue: true}     but still don't know how to intercept my topic with a random value

redraccoon
Star Contributor
Star Contributor

a random prefix for the scope is generated to be shure that all of your widgets inside your form are saff and together, you can desactivate this option with 

scopeFormControls: true

Or better solution rename this random scope with pubSubScope

name : "alfresco/forms/Form",
config : {
pubSubScope : "fixedPrefixScope",

okButtonPublishTopic : "REDRACCOON",
widgets : [ ]

            }