Step 2
Find the Component ID for the table component that contains the action link as shown in the image below. You will need it for the next and final step!
Tip: Double click on the info icon 🛈 to quickly copy the component ID
Step 3
Finally, copy and paste the following code into the JavaScript section of your page.
var confirmationText = 'This will set the Contact Date to the current date. Do you want to continue?';
var setOnClickEventsForActionLinks = function(element){
element.find('.action-link-confirm a').click(function(){
var r = confirm(confirmationText);
if (r === true) {
return true;
} else {
return false;
}
});
};
TB.render('component_X',function(data){
var element = data.ele;
setOnClickEventsForActionLinks(element);
$('body').click(function(){
setTimeout(function(){
element.find('.action-link-confirm a').off();
setOnClickEventsForActionLinks(element);
},800);
});
});
Please remember to change component_X in the code, to the component ID from step 2.
Now that we have the option to add classes to Table Columns and we have the Tadabase JavaScript API, I was able to update the post and code above to 3 easy steps. Please review it again and let me know if it works out for you now.
Can this also be used on a delete button? I thought I had it working, but it’s not.
It opens the dialog box, but if you click yes, it does not delete the record.
I updated an action link with the script you provided. It looks so much cleaner and polished. However, I discovered that when “Yes” is selected, the action link is not triggered.
I did some troubleshooting and the {buttons: [“No way!”, “Yes, proceed”],} seems to be part of the issue. When I remove the code you suggested, the action is triggered.