Yes, there is a lot of utilizations - preview, autosave, realtime checks of form fields (unique page_alias etc) or whatever.
I am just playing with one enhanced database filter - which will show count of accepted records just in time user changed form fields and before he clicks to button 'DISPLAY'. I do not like iframes and I am pretty stupid man (or: I hate so-called language named JavaScript) and it is very complex webpage with a lot of informations and it is pretty old too, so a lot of hands was changing its code... You know what I mean, I am sure. There is tens of reasons why I don't want to reload whole page just because client wants this integer in form. By the way - he is right - I also hate filters, which returns 'no records'
OK, I will sit down and write some simple example how to utilize module XajaxInterface right now.
TASK: I want to write a plugin, which will:
- track down all words, which user types in some textareas in public interface - include wrong typed and later corrected one's, exclude last word in text
- inform user how many unique words was used in this textarea in during last check
- for debug purposes I want to be able to display all of unique words, collected in during actual session
WHAT OUTPUT OF INDEX I WANT: text files in directory /tmp/cache with names like session_id().'.wordindex.txt' and content: all words which user typed in protected textareas
WHAT I NEED: CMSMS, module XajaxInterface, textarea with own HTML id on public page (hand-coded, from other module, or from other plugin...)
WHAT I HAVE TO DO: write short php file (plugin), copy it into plugins directory and declare it in page with watched textarea
IN DETAIL:
- every XXX seconds send content of textarea with id YYY to server
- split this text by spaces, cut off last word (it can be unfinished) - I don't care about person which types text from the middle, so I know there will be a lot of words in index
- if it is necessary, update index of unique words in text file of this session
- change innerHTML parameter of some DIV - put here count of unique words in this textarea
- if we are running debug mode, display all unique words for this session (not only for this textarea)
HOW I WANT TO USE THIS PLUGIN:
There will be only one required parameter:
Code: Select all
{wordindex textarea_id='userRequest'}
manage textarea with id 'userRequest', default 3 seconds interval
Other examples of use:
Code: Select all
{wordindex textarea_id='userRequest' interval='2000'}
manage textarea with id 'userRequest', 2 seconds interval (2000 miliseconds)
Code: Select all
{wordindex textarea_id='userRequest' debug='1'}
manage textarea with id 'userRequest', default 3 seconds interval and display all unique words from watched textareas (for my session, of course)
So people, try to check this topic later - I am going to rewrite module XajaxInterface (I need more options for registration callback functions for my purposes) and then I will put all stuff here.