Topic: Ajax in FA - Analysis (WIP)

There appears to be a lack of documentation (even in the wiki) regarding Ajax as used in FrontAccounting. Before making a wiki page for it, those in the know can contribute to this thread from where it will be distilled into the wiki.

If on the change of value of any FA form element, some ajax work needs to be done (like other form elements getting updated or some function being executed), then a $_POST array element needs to be set and sent.

The $_POST array element must bear a name that embeds the ajax requesting element's name attribute as seen in Lines 300 to 307 in the function list_updated($name) in includes/ui/ file:

    Helper function.
    Returns true if selector $name is subject to update.
function list_updated($name)
    return isset($_POST['_'.$name.'_update']) || isset($_POST['_'.$name.'_button']);

Hence if the ajax requesting form element is stock_id then the hidden form elemet that is sent over for an ajax call in FA would either be:
for the function list_updated($name) to trigger the ajax response.

To get the response inside a target form element, it's name attribute is passed on like $Ajax->activate('price').

This is seen for example in lines 506-511 in sales/includes/ui/

        if (list_updated('stock_id')) {

All functions that assist ajax responses are in includes\ui\

Re: Ajax in FA - Analysis (WIP)

The wiki page for Ajax in FA is ready for updation.

Re: Ajax in FA - Analysis (WIP)

Hi apmuthu,
I have seen the WIKI page for Ajax in FA, but it only contains information about updating fields, is there any way I can list data using ajax in FA ?
e.g. Suppose I'm having around more than 1 lac records in my stock_master then it will take forever to load Item page. So here I'm thinking of implementing ajax listing (like autocomplete), Please suggest me if there is any better option for this issue..

Re: Ajax in FA - Analysis (WIP)

Have you seen the ajax search box means of choosing an item, supplier or customer by using the appropriate checkboxes in the company setup form? Similar paged lists are also available for items, suppliers and customers in some other forms on pressing the search icon (magnifying glass) beside those fields.

Re: Ajax in FA - Analysis (WIP)


how the function list_updated($name) will know which code or function should be triggered to return the response?