Calling client JavaScript from server PHP, display Message Box with Answer

    Calling client JavaScript from server PHP, display Message Box with Answer

    I have for a long time wanted to be able to display a message box from a macro and accept input from the user at the same time. I know that a Widget can be used but there are times when I want the macro to drive the process without a new UI element. One case is a simple Yes/No message prompt.

    I have finally found a way to do this. It involves non-standard Jedox code and probably won't be an "approved" way. Maybe in the future the Jedox development team will come up with a standard approach. In the meantime, see the macros below. This code chains from one macro function to another with a message box intervening. The results of the message box are passed to the second macro function.

    Because this could change in a future Jedox release (I am using 5.1), it is best not to imbed them in a workbook but instead to keep the functions in a separate PHP file that can be included. One more thing on my wish list is a built-in Jedox way to do this. I have some workbooks with thousands of lines of macro code and I would like to organize them better.

    I have attached the code for two useful functions. Here is the sample macro I used in a test workbook:

    function _Button1_Click ()
    {
    return __ShowMsgBox("TEST","Press Yes or No...","QUESTION","YESNOCANCEL","Module1._Button1_Click2");
    // OR:
    return __ShowMsgPrompt("TEST","Enter Something","Module1._Button1_Click2");
    }

    function _Button1_Click2 ($btn,$text)
    {
    return array(array('msg','info','Result',$btn.': '.$text));
    }

    Jerry Metcoff
    York Group BI, LLC