So, I do not believe there is a built-in way to pop up a message/prompt when filling out a form. However, I have confirmed that it is possible to achieve behavior similar to what you are proposing with a custom extension-lib. Basically the idea is to create a custom extension-lib function that allows for opening an alert from the browser/app.
const getValue = function(obj) {
let val;
if (obj.t === 'arr') {
val = obj.v && obj.v.length && obj.v[0];
} else {
val = obj.v;
}
if (!val) {
return '';
}
return val.textContent;
};
module.exports = function(first) {
const message = getValue(first);
window.alert(message);
return first;
};
Then you can use the extension-lib function in a form like this:
type
name
label::en
relevant
appearance
calculation
begin group
page
NO_LABEL
field-list
string
message
Enter alert message
trigger
show
Show Alert?
calculate
alert
${show} = “OK”
cht:extension-lib(“alert.js”, …/message)
end group
page
This will cause the alert to be opened whenever the alert field becomes relevant. (Also, you could use window.confirm in the extension function instead if you want to record a boolean value of the user’s response to the alert.)
This would work for brief notification messages, but is probably not ideal for long-form documentation. For that it would be nice to have a more sophisticated approach. Several issues have been logged recently that would provide interesting options here: