This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

button confirm
#1
Hello, is it possible to validate an action like this with a button? 
<script> 
if (confirm("Do you want to continue?")) { 
document.write("yes") 
} else { 
document.write("no") 
}; 
</script> 

Thank you
Reply
#2
What task do you have exactly?
Reply
#3
(01.06.2026, 13:07)admin Wrote: What task do you have exactly?

ask for confirmation of the operation I am going to do if I answer yes
Reply
#4
Ok, but what action do you want to perform? Change group address, show a different plan or open some link? Is it something that can already be done using an existing widget (which?) or do you need something fully custom?
Reply
#5
(02.06.2026, 07:45)admin Wrote: Ok, but what action do you want to perform? Change group address, show a different plan or open some link? Is it something that can already be done using an existing widget (which?) or do you need something fully custom?

Simply, from a virtual button with a script, I'd like an alert that authorizes its execution. 
For example, if you leave the house, it responds, "Are you sure?" Yes, I execute the command; no, I cancel the command.
Reply
#6
A out of the box option(no the same) is PIN protection.
------------------------------
Ctrl+F5
Reply
#7
This example adds a confirmation to the switch widget.

Change widgetId value to your switch widget ID. ID is shown in the window title when editing a widget.
Code:
const widgetId = 26 Visu.on('widget-ready', widgetId, ({ widget }) => {   const component = widget.component   const handler = component.compactModeClick      component.compactModeClick = () => {     Visu.emitter.emit('confirm-dialog-show', {       text: 'Are you sure?',       callback: handler     })   } })
Reply
#8
Fantastic
Reply


Forum Jump: