Page 1 of 1
Confirmation Popup on click of button
Posted: Wed Oct 16, 2019 1:18 am
by sia
Hello all,
Is there anyway to put up a confirmation popup on click of button and then on "yes"- say delete the desired element and for "No" - do nothing ?
Thank you.
Regards,
Sia
Re: Confirmation Popup on click of button
Posted: Thu Oct 17, 2019 2:04 pm
by alex_jitianu
Hello,
The fastest way I can think of is with an XQuery Update script that uses a bit of Java reflection to present a dialog:
Code: Select all
declare namespace jop = "java:javax.swing.JOptionPane";
let $result := jop:showConfirmDialog(null, "Delete element", "Confirm", 0)
return if ($result = 0) then (
delete node .
) else ()
The button is added like this:
Code: Select all
element:after {
content: oxy_action(
name, 'Delete',
description, 'Delete',
operation, 'XQueryUpdateOperation',
arg-script, oxy_url('delete.xquery')
)
}
In this example the script sits in a file named
delete.xquery, next to the CSS.
Another option would be to create a
custom author operation that present the dialog and removes the fragment as well.
Best regards,
Alex
Re: Confirmation Popup on click of button
Posted: Tue Oct 22, 2019 11:16 pm
by sia
Thank You. The solution is working as expected.