Looks good. Haven't used it, but a couple things come to mind:
- You're requiring the user to custom code his own suggestion() AJAX call for every instance of the form field. This may work for users who have really specific functionality, but for most of us, we're going to want that to work out of the box, without any custom coding. It seems to me, you could make it more modular, and add a SuggestionField_Controller class that contains a generic suggestion() function for the AJAX call. You could even assume that the two fields you're looking for are Title and Link, and the user could override those in the constructor.
- You should use MATCH and AGAINST instead of LIKE.
- To get the $URL variable, you can save yourself a lot of trouble and use $('base').attr('href');
- In your Javascript, the line "jQuery.noConflict()" does nothing unless you return that to a variable, for example:
$J = jQuery.noConflict(); $J('#my-element').hide();
- For the suggestion function in the Javascript, you're going to need to use submission throttling to prevent a sequence of rapid AJAX requests. For those of us who are fast typists, we're only going to want to see one ajax call when we're done typing. Not ten of them all at once, one for each keystroke. I did this in the Search function of DataObjectManager if you want an example. You need to store a setTimeout resource and nullify it everytime the user hits a key within say, 0.5 seconds of the last one.
Very nice, though. This is a great idea.