0

I am in the process of creating a new type of Custom Field. (Joomla 3.9x)

As a new Field under Plugin.

I need to have a confirm-dialog on beforeSave, but I can't find any proper tutorial on how to do that.

How do I implement a javascript confirm in a Field-plugin

<?php
defined('_JEXEC') or die;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

class PlgFieldsintorder extends FieldsPlugin
{
    public function onContentBeforeSave($context, $item, $isNew, $data = array())
    {
        // pseudocode:
        // if (window.confirm("Do you really want to set this value?")) { 
            // do something in php/sql;
        // }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.