The functions available on reasoned answers API are:
Function | Description |
---|---|
getPopup() | Retrieves response popup |
registerForFieldChange(fieldName, callback) | Allows subscription to field modification in response popup |
getReasonedAnswerId() | Retrieves action identifier |
getTasks() | Retrieves the list of tasks associated with the response |
Examples:
JSAPI.get().registerForReasonedAnswerOpen(function(reasonedAnswerAPI, reasonedAnswerId) {
console.log("Opened reasoned answer Id: " + reasonedAnswerAPI.getReasonedAnswerId());
});
JSAPI.get().getReasonedAnswerAPI(<answer identifier>).registerForFieldChange("Comments", function(fieldName, fieldValue) {
console.log("Value of " + fieldName + " changed to: " + fieldValue);
});
Note: In this part, the variable reasonedAnswerId
is used to identify the response just opened
Please note: When displaying several reasoned answers forms, it may be necessary to access a particular form: JSAPI.get().getReasonedAnswerAPI(<answer identifier>)
.