一次性在自适应卡中使用后如何禁用按钮 [英] How to Disable Button after single use in a adaptive card
问题描述
我在我的LUIS代理中使用自适应卡.我想如果用户已将自适应按钮中的详细信息填满,则提交按钮应被禁用. 而且我还想知道当我们在按钮单击上显示嵌套的自适应卡时如何隐藏按钮
I am using adaptive card in my LUIS agent. I want if a user has filled the details in an adaptive card after that the submit button should get disabled. And also i would like to know that how to hide a button when we are displaying a nested adaptive card on a button click
我尝试使用用户输入的值来验证卡.但我正在为此寻求更好,更优化的解决方案
I have tried validating the card using the values input given by the user. But i am looking for a better and more optimal solution for this
p.s正在使用bot框架v4 API
p.s working on bot framework v4 API
推荐答案
在网络聊天中,可以在Azure机器人的传入活动"事件中处理隐藏/禁用提交按钮.您可以从自适应卡的JSON文件中获取"your_submit_button_id".
In webchat, hiding/disabling submit button can be handled in "Incoming Activity" event of Azure bot. You can get 'your_submit_button_id' from JSON file of adaptive card.
const store = window.WebChat.createStore(
{},
function (_ref) {
const dispatch = _ref.dispatch;
return function (next) {
return function (action) {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: { language: window.navigator.language }
}
});
}
if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {
const event = new Event('webchatincomingactivity');
event.data = action.payload.activity;
/* hiding/disabling button code starts here */
if(event.data.value!=undefined && event.data.value.id=='your_submit_button_id')
{
var btnArr=document.getElementsByClassName("ac-pushButton");
btnArr[btnArr.length-1].style.display='none';
//btnArr[btnArr.length-1].disabled = true;
}
window.dispatchEvent(event);
}
return next(action);
};
};
});
这篇关于一次性在自适应卡中使用后如何禁用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!