1 (edited by bhoo-day 06/24/2011 04:23:09 am)

Topic: Implementing Approval Method Related to AJAX in FA

Hello everybody,

I'm developing a custom module for budgeting usage. There is a approval feature to determine whether the budgeting usage is okay or not.
The problem I faced is I can't hide the approval button after I press the button and the Ajax run. The approval button is still there and I also can't display the notifications.

Here is my snippet codes

if($_POST['approve'])
{
    $budget_usage_id = $_POST['budget_usage_id'];
    
    approve_budget_usage($budget_usage_id);       
    
    display_notification_centered(_("The Budget usage has been approved."));  // Can't display it

    $_POST['approved'] = '1'; // Approved

    $Ajax->activate('buttons');  // Should I use ajax here??
    
}

For display

        <p id="buttons" style="text-align: center">
        <?php if($_POST['approved'] == '0'): ?> // Cek if the budget is approved or not
                <?php submit('approve', _("Approve"), true, '', 'default'); ?>
        <?php endif; ?>
        </p>     

I'm still curious about it even though I can use JQuery for it but it could be great if I can use Ajax from FA.

Thanks.

Re: Implementing Approval Method Related to AJAX in FA

Try use div_start('buttons'), div_end() instead of <p> tags.
Paragraph tags need additional coding to make it working (see div_start/end code in ui_controls.inc).
Janusz

Re: Implementing Approval Method Related to AJAX in FA

hi bhoo-day,
how is your code? does janusz reply solve your problem?
i just searching approval module in many step in purchasing, sale, etc.
i hope bhoo-day can spread the code if it's good result.