Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.1

Request #14021 Include live.js into livesearch_select.php
Submitted: 2008-05-30 05:32 UTC
From: shangxiao Assigned:
Status: Open Package: HTML_QuickForm_Livesearch (version 0.4.0)
PHP Version: 5.2.6 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2008-05-30 05:32 UTC] shangxiao (David Sanders)
Description: ------------ To make it easier for packaging, deployment and rapid development (which is what QF is designed for), it'd be beneficial to include the javascript in live.js inside the html that this plugin outputs. I see that you've already got conditional outputting for the styles with your HTML_QUICKFORM_LIVESEARCH_EXISTS constant, so this javascript could easily go into that. This way this plugin would be 1 step less in setup overhead and 1 step closer to being plug-n-play.

Comments

 [2008-05-30 08:35 UTC] thesee (Giuseppe Dessi)
Now the live.js is loaded from HTML_AJAX, in the auto_server.php you can find the line: $server->registerJSLibrary('QfLiveSearch','live.js','./'); I prefer not write the entire js into the html, i think it can be a good idea to let him alone, so it can be simple "hacked". It possible to make it as an option but i think it can be confusing. Let me know what do you think about :) thank you
 [2008-05-31 07:59 UTC] shangxiao (David Sanders)
No option, just include it into the HTML. If the only reason you're separating it is so that it can be hacked or simply because "it seems like good software engineering practice" then they aren't good reasons. The only person who should be hacking the javascript is the developers of the plugin. Once you get it working then nobody should need to modify it's behaviour unless it's through style definitions or options provided through the plugin's api. Let me restate the reasons to include it: 1. It's one less thing to remember to setup when creating a form with livesearch 2. It's one less thing to remember to install in an application 3. It's one less file to clutter up the custom space of my web app 3. Having the functions in the same file as the calling point makes it easy to read and review 4. It's one step closer to having a quick quickform setup so that it's immediately ready to go. Quickform was designed for rapid development. In addition to this request, I think the link to your ajax server should be placed in here as well. Again it's one less thing to remember to setup. I can't think of a reason why you'd want to leave it up to the user to link it in their controller script.