CVS edit link for ziomizar

For the moment i need to add autocomplete functionality in any text input form.
Not only cck, taxonomy or search but in all text input fields.
I have developed a simple module that i want named Autocomplete, with this module you can add a result of a Views or a custom Sql into any text field.

This is my first request of an csv account and i hope that you give me the opportunity of collaborating with community.

Comments

ziomizar’s picture

Title: ziomizar [ziomizar] » Autocomplete
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new65.27 KB

Hehehe i'm sorry for my super motivation, i have not understand the word Motivation and how this request form works :P.

This is what i want to do :

if i have an HTML field with type=text , i want be able to add autocomplete functionality in their fields, getting results by Views Module or Custom Sql.

This is pretty simple with Jquery.

In this way i can bypass all the situations when i have not autocomplete functionality. ie: view exposed filter, custom form, ecc..

i have attached some file to let you see how it works.

trungonly’s picture

I see a big jquery.js file (100K) included in your package. Do you think we can use current jQuery version of Drupal instead and get rid of this duplicate?

ziomizar’s picture

Yes you are right,

I have put into my lib directory, all libraries that i found in Jquery Autocomplete plugin.
But when i load the module, are used only autocomplete/includes/jquery.autocomplete/jquery.autocomplete.js and autocomplete/includes/jquery.ajaxQueue.js.
Other libraries in this base version are "only" present in this package.

ziomizar’s picture

StatusFileSize
new14.77 KB

Hi,

I have added in this package:
- hook_perm() : Backend and Frontend(than you must set permission for see autocomplete in frontend!)
- rivisited also all code with coder module.
- dependency by jquery (tnx trungonly)
- removed all .js and files not used (tnx trungonly)

I have found here http://drupal.org/node/392700 people that maybe need of this module from 2009.

If you want try with Sql custom, the sintax is the same of db_query() ie:
SELECT title FROM {node} WHERE title like '%s%%'
in this way is the same that writing ie:
SELECT title FROM {node} WHERE title like 'hello%'
because %s will be the AJAX variable , and LIKE operator use %% (db_query transform double %% in only one %).

If you want try Views, is more simple but you must have :
- A View, with one Exsposed Filter. Later set this filter_name in the Autocomplete module. This filter will be the Ajax parameter, and will make the query that will be put in the autocomplete field.
- All configuration will be made by Views side
- All template customization will be made by Views side
- Autocomplete remove all html tags from Views results.

The field_id will be the HTML id of the textfield without #,
than if your textfield is #test-field you can write : test-field

avpaderno’s picture

Title: Autocomplete » ziomizar [ziomizar]
Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thank you for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.

As per requirements, the motivation message should be expanded to contain more features of the proposed project. For themes, it should include also a screenshot of the theme, and (when possible) a link to a working demo site; for modules, it should include also a comparison with the existing solutions.

ziomizar’s picture

I have already exposed the features of this modules in this discussion,

comparison with existing module (finding on 'module search' keyword "autocomplete" ):

----------------------------------------

- http://drupal.org/project/autocomplete_widgets : is only for cck and only text and number
** create NEW autocomplete fields and only for cck.
** my module add autocomplete functionality in all text type item in a HTML page

-----------------------------------------

- http://drupal.org/project/finder : Create forms for users to find stuff,
And the Finder Autocomplete is for : Enables autocomplete textfields for finder
** create a new form for search, with a some field autocomplete only for finder form
** my module add autocomplete functionality in all text type item in a HTML page

-----------------------------------------

- http://drupal.org/project/cck_autocomplete
** moved to - http://drupal.org/project/autocomplete_widgets

-----------------------------------------

- http://drupal.org/project/nodereference_explorer
** autocomplete only for nodereference

-----------------------------------------

- http://drupal.org/project/keyword_autocomplete
** Keyword Autocomplete lets you add autocomplete functionality to your site's search forms based on previously searched strings

------------------------------------------

- Apache Solr Autocomplete
** Install and enable module. All search boxes that lead to an Apache Solr search will automatically be autocomplete-enabled.
** than is apachesolr only

------------------------------------------

- http://drupal.org/project/autocomplete_element
** you must create a new form then a module for use this one. Not is possible referencing to existent form or text element (without write your custom module).

------------------------------------------

- http://drupal.org/project/form_beautifier
** i have not see possibility of choise query o r view to make autocomplete, and i not see no one functionality for autocomplete.

------------------------------------------

all these solutions are focus on their own text element.
Not is possible with any of this module adding autocomplete functionality to a textfield on another module or form element.

My module functionality are :
- Can add autocomplete functionality at all text field present on a HTML page (not a form, need only that element exists).
- Can create your custom query for select option in autocomplete suggestions.
- You can choise Views Module, for create your custom query for getting result list.
- You dont must create your custom module for using it, only choise a query or a view (not like a http://drupal.org/project/autocomplete_element)
- You can add autocomplete functionality when a module don't provide fully autocomplete functionality.

ziomizar’s picture

Status: Needs work » Needs review

change status

avpaderno’s picture

Status: Needs review » Needs work

The only explanation I find for the purpose of the module are the following three sentences:

For the moment i need to add autocomplete functionality in any text input form.
Not only cck, taxonomy or search but in all text input fields.
I have developed a simple module that i want named Autocomplete, with this module you can add a result of a Views or a custom Sql into any text field.

As reported from the requirements, you must provide a motivation message, which should be a few paragraphs instead of only a few sentences.

ziomizar’s picture

Status: Needs work » Needs review

Hi kiamlaluno, thank you for your reply.
I have join all messages of this issue and rewrite one big motivation :
---------------------------------------------------------------------------------------------------------

For the moment i need to add autocomplete functionality in any text input form.
Not only cck, taxonomy or search but in all text input fields.
I have developed a simple module that i want named Autocomplete, with this module you can add a result of a Views or a custom Sql into any text field.

All these solutions (see post http://drupal.org/node/933490#comment-3548094) are focus on their own text element.
Not is possible with any of this module adding autocomplete functionality to a textfield on another module or existing form element.

The functionality that i want add in this issue are :
- Can add autocomplete functionality at all text field present on a HTML page (not a form, need only that #id of html element exists).
- Can create your custom query for select option in autocomplete suggestions.
- You can choise Views Module, for create your custom query for getting result list.
- You dont must create your custom module for using it, only choise a query or a view (not like a http://drupal.org/project/autocomplete_element)
- You can add autocomplete functionality when a module don't provide fully autocomplete functionality.

Main Motivation for this module:

The main goal of this module is Autocomplete with Jquery when a module that play with forms, or custom form, don't provide this function in some fields.
Without this, we must write custom modules (with the same code repeating) every time we need a field with autocomplete or in other cases make a changes in existent module(not all people are familiar with module developing).

in this topic http://drupal.org/node/392700 you can see an example of developers that may need of this module for adding autocomplete in view exposed filter.

ziomizar’s picture

StatusFileSize
new15.01 KB

I have added

/*
* @file
*/

in all .php files of the module.

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order of importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. The version line needs to be removed from the .info file.
    The package name is used when the package name is already used from another module.
  2. Files available from third-party sites should not be committed in Drupal.org repository. Files licensed under a license different from GPL License (even if it is a compatible license) should not be committed in Drupal.org repositories.
  3. Hook implementation comments should be like the following one:
    /**
     * Implements hook_menu().
     */
    

    As reported in Documenting hook implementations:

    If the implementation of a hook is rather standard and does not require more explanation than the hook reference provides, a shorthand documentation form may be used in place of the full function documentation block described above:

    /**
     * Implements hook_help().
     */
    function blog_help($section) {
      // ...
    }
    

    This generates a link to the hook reference, reminds the developer that this is a hook implementation, and avoids having to document parameters and return values that are the same for every implementation of the hook. Optionally, you can add more information in a separate paragraph to describe the particular quirks of your hook implementation.

    In the case of hooks that have variables in the names, such as hook_form_FORM_ID_alter(), a slightly expanded syntax should be used:

    /**
     * Implements hook_form_FORM_ID_alter() for node_type_form().
     */
    function mymodule_form_node_type_form_alter(&$form, &$form_state) {
      // ...
    }
    

    This generates a link to the hook reference, as well as to the particular form that is being altered. Again, optionally you can add more information in a separate paragraph to describe the particular quirks of your hook implementation.

  4. None of the module functions are prefixed by hook_.
  5. Before exit, the code should call module_invoke_all('exit').
  6.       drupal_set_message(t(check_plain("Remove autocomplete from field $fid finish successfull")));
    
    

    Use t()-placeholders. The string passed to t() is not passed to check_plain().

  7.   drupal_set_message("Error until delete of $fid ". $query);
      drupal_goto('admin/build/autocomplete');
    
    

    Strings used in the user interface should be translated. Error until delete is not grammatically correct.

  8.     '#description' => t("SQL query. This field is not compatible with view, 
                              and have priority on view. So choise to write your 
                              own SQL query if you don't wont use Views module. 
                              You must be use %s standard for yoir query param. Es: 
                             SELECT * FROM {autocomplete} WHERE title = '%s'"),
    
    

    There are some typos in the string (choise is not a verb).

  9.     form_set_error('autocomplete', 
                t("The choise field id {$input_field_id} is already in use, 
                    please choise another field id.*" .
                    autocomplete_get_field( $input_field_id ) . "!=$input_field_id"));
    
    

    The first argument of form_set_error() is the form field identifier.
    The first argument of t() is a literal string, not a concatenation of strings. The script used to create the translation template is not able to handle any dynamic value, even in the case of code similar to t($variable), or t(function()); this means that if the argument of the function is not a literal string, it will not appear in the translation template.

  10.   if ($type == 'Views') {
        if (isset($view_name) && isset($input_field_id)) {
          $view = '';
          if ( ! ($view = views_get_view( $view_name )) ) {
            if (!module_exists('views')) {
              drupal_set_message("the Views module is not installed");
            }
            else {
              drupal_set_message("the Views module is installed and fight");
            }
            form_set_error('autocomplete', 
                    t("The view {$view_name} not exists. Plese enter a valid views name"));
    
          }
          $filter_test = $view->get_item('default', 'filter', $filter_name);
          if ( (trim($filter_name) == '') || !$filter_test ) {
            form_set_error('autocomplete', "the Filter for this Views not exits");
          }
        }
        else form_set_error("If you choise View type you must insert : view name and view filter");
      }
    
    

    See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted.
    In English, there isn't a space before the colon.

  11.   $input_type       = $form_state['values']['autocomplete_type'];
      drupal_set_message("Field $input_field_id active with autocomplete");
    
    

    Strings used in the user interface should be translated.

trungonly’s picture

Please check typo "finish successfull".

ziomizar’s picture

Status: Needs work » Needs review
StatusFileSize
new15.89 KB

Hi kiamlaluno, thanks for your review.

1. removed version line and package from .info file
2. all files included in my package are also GPL.
3. fixed comments in the hooks
4. removed hook_ from one function
5. added module_invoke_all('exit'); before exit();
6. added placeholders in t() function and removed check_plain when not necessary.
7. translated all string in user interface and i tryed to recheck all grammatically errors
8. i tryed to recheck all typos in the strings
9. thank you.
10. i have reread http://drupal.org/coding-standards and recheck all also with Coder module.
11. Fixed all strings used in user interface
12. Added README.txt

ziomizar’s picture

StatusFileSize
new15.89 KB

Fixed another formatting error.

avpaderno’s picture

Files available from third-party sites should not be committed in Drupal.org repository, independently from the license used for the files. There is actually a case where committing such files is possible, but this doesn't seem the case.

ziomizar’s picture

StatusFileSize
new7.12 KB

Hi kiamlaluno,

If i can't use third-party files, I need to add dependencies from jQuery(for framework)
and Autocomplete_Element(to include jquery.autocomplete.js).

I have removed directory /include from the package

avpaderno’s picture

Your code can depend from files that are available from third-party sites, but you cannot commit them in Drupal.org repository; the reason for not committing them in Drupal.org repository are mainly four:

  1. Drupal.org is not the repository for third-party project files; it is thought for Drupal themes, modules, and installation profiles.
  2. If third-party files are committed in Drupal.org, then you would need to create a new version of your module every time there is a new version of the library files.
  3. Every module that use the same library would need its own copy of the library files, with the consequence that a Drupal-powered site would have multiple copies of the same files, one copy for each module that uses those files; if the user is instructed to copy the files in a site directory, there would be a single copy of every file (the module need to be flexible on where to look for the required files).
  4. In the case different modules require a different version of the library, there could be conflict issues. Imagine what would happen if a module would come with version 1.x of a jQuery plug-in, while another module comes with version 2.x of the same plug-in; if both the plug-ins would be loaded in the same page, one of the modules (or both) would not work correctly.

There are many modules that use third-party libraries, and they require the user to install them separately.

ziomizar’s picture

Yes you are right,

But the jquery.autocomplete.js need a fix for working with drupal, becouse the param for ajax call named "q" and would to be changed.

Then if i require the user install them, i require also that the user apply a patch in them and this is (not much but...) difficult for some people.

This module is already dependant from the jQuery pugin that is the main example of third-party libraries in drupal.org.
Unfortunatly not include autocomplete library, that is included in Autocomplete Element.

1. You are right
2. Yes but my module is named autocomplete, and in my motivation i say that this works with jQuery. Then my module MUST be updated every time there is an update of the jQuery UI or an update of autocomplete plugin.
3. Yes i took autocomplete plugin from the module "Autocomplete Element"
4. The version of library is the same, and the fix is the same.

avpaderno’s picture

If the plugin is a modified version, and there is already a module that comes with the modified plug-in, then the proposed module should depend on it; if there is not a module that includes the modified jQuery plug-in, then including the plug-in would be the correct way (and it is listed between the reasons to include a third-party library).

I am just suggesting what should be done; this is not something that blocks the application approval.

ziomizar’s picture

For the moment i can include (and already included in post #16) dependency from autocomplete_element that already include the modified library with the same fix.
Then this is the better solution for not duplicating same code of third-party.

In future if i will need of a different plugin version,
i can open a new discussion or open an issue on jQuery_UI module or other,
in all ways in future i can ask at the community what will be the best solution.

ziomizar’s picture

There are other problem.. or can you give me a CVS account?
see post #16 for last release.

ziomizar’s picture

news?

1mundus’s picture

Why don't you give ziomizar a chance to release this as a module? This is a essential functionality for many of us and there is no adequate solution for autocomplete in exposed filters or similar.

ziomizar’s picture

thank you 1mundus

bastid’s picture

Assigned: Unassigned » bastid
Category: task » support

Hi Ziomizar,

Seems that your module is all I ever waited for! I installed your latest version, but I cannot get it running.

I tried to use it in views-mode. I selected the view ("Jobs") which I want to enhance by your autocomplete feature. In "Input field id:" I entered the name of the field I want to search through, in my case it is "field_location". In "The view filter name:" I entered to name of the filter, in my case it is "field_location_filter".

When I click "save" I get the message: "Filter #field_location_filter for Jobs not exits".

As I do not have enough Drupal experience I cannot see the mistake by myself.

Thank you in advance!

Best

Sebastian

ziomizar’s picture

Hi bastid

I tried to use it in views-mode. I selected the view ("Jobs") which I want to enhance by your autocomplete feature.

In "Input field id:" I entered the name of the field I want to search through, in my case it is "field_location".

than if your input type is like this [input id="field_location" name="test-field" type="text"] its ok.


In "The view filter name:" I entered to name of the filter, in my case it is "field_location_filter".
When I click "save" I get the message: "Filter #field_location_filter for Jobs not exits".

If this is exactly the report message, i think that you should remove # from the filter name (and use Filter identifier not Filter name sorry!).

If this is not a valid solution, i think that will be better writing a bit of code to avoid similar problem(could be show a list of filters.. in this way will be not necessary that users remembers all ids of fields.).

avpaderno’s picture

Assigned: bastid » Unassigned
avpaderno’s picture

Category: support » task
itangalo’s picture

Component: Miscellaneous » miscellaneous

Note: I cannot approve or decline CVS account applications, but I'm trying to help real coders in reviewing applications more efficiently. The following comments are *not* ground for approving or declining an application – just a help to get going.

I had a look at the module, and just a few comments:
* There was a typo in the module description (.info file) – 'ustom Sql' should probably be 'custom SQL'.
* In autocomplete.module, lines 79–85, there is a non-standard formatting on a comment.
* In autocomplete.module, the line break at line 242 and 243 decreases readability.
* In autocomplete.module, there are two blank lines at the end (while Drupal standard says one).
* In README.txt, line 27, there is a typo period (.) in the middle of the sentence.

I'd say all of these issues are minor, and not blockers for CVS account.
The module functionality seem different enough from other autocomplete modules.
I have NOT security reviewed the module.

Good luck!

avpaderno’s picture

Component: miscellaneous » new project application
Status: Needs review » Needs work

I am changing the status as per previous comment.

ziomizar’s picture

StatusFileSize
new7.13 KB

Thank you itangalo,
At the moment i'm not sure that this module will be usefull for drupal user, i'm waiting for approval from October. However i have fixed your issues.

* There was a typo in the module description (.info file) – 'ustom Sql' should probably be 'custom SQL'.

-> yes , fixed

* In autocomplete.module, lines 79–85, there is a non-standard formatting on a comment.

-> fixed

* In autocomplete.module, the line break at line 242 and 243 decreases readability.

-> fixed, i have split into two line separated by period.

* In autocomplete.module, there are two blank lines at the end (while Drupal standard says one).

-> I have only one line at the end of the file autocomplete.module

* In README.txt, line 27, there is a typo period (.) in the middle of the sentence.

-> fixed

itangalo’s picture

Status: Needs work » Needs review
arianek’s picture

Status: Needs review » Postponed

Hi. Please read all the following and the links provided as this is very important information about your CVS Application:

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications

  • The status of this application will be put to "postponed" and by following the instructions in the above link, you will be able to reopen it.
  • Or if your application has been "needs work" for more than 5 weeks, your application will be marked as "closed (won't fix)". You can still reopen it, by reading the instructions above.
ziomizar’s picture

Hi arianek,

I'm a bit disoriented because this is my first request for a project.

I have read the more importants points of your links. I have agreed with git licence and I have set up my git username, now i can see http://drupal.org/node/add/project-project (create project form), and I have create my Sandbox project page.

Now i should close this CSV approval request and work with my sandbox project page, right?

gusti77’s picture

Are there any news about this? I really, really need this functionality, and many other people do too. I've downloaded the last version of the module and tried using it on a view of my site, but I keep getting an error message ("filter x for view not exists")

itangalo’s picture

Status: Postponed » Needs review

This issue should be changed to 'needs review' -- if you're applying to create a 'real' project (and not only a sandbox project).

@gusti77: It should be possible to post issues and have discussions in the sandbox project, just so you know. And, I may add, it is good with feedback like this -- it shows that the module is needed and appreciated.

jthorson’s picture

Title: ziomizar [ziomizar] » Autocomplete
Project: Drupal.org CVS applications » Drupal.org security advisory coverage applications
Component: new project application » module
Issue tags: -Module review

Updating issue with requirements as linked to in comment #33:

Updated title
Moved issue from the CVS to Git application queue

Link to the Sandbox Project Page: http://drupal.org/sandbox/ziomizar/1076018

Now that the application is in the proper application queue, another reviewer should be along to continue review process shortly. (Please be patient, as the current queue backlog is somewhere in the order of 4 weeks.)

sreynen’s picture

Status: Needs review » Needs work

Please address the open issue and move this back to "needs review" status.

misc’s picture

The applicant has been contacted to ask if the application is abandoned.

misc’s picture

Status: Needs work » Closed (won't fix)

The application has been closed. If you would like to reopen it, you are free to do so.
See http://drupal.org/node/894256