Name of module : Autocomplete Dependent Population
This module provides ability to populate dependent form elements of an autocomplete form element with proper values.
This module introduces "autocomplete_dependee" type form element which allows to create an autocomplete field.
You can define form elements which will be populated when the value from autocomplete suggestion is selected. This
form elements can be of following type:
Textfield
Textarea
Dropdown
Radio button
Checkboxes
A form can have multiple "autocomplete_dependee" type form elements.
link to its sandbox project : https://www.drupal.org/sandbox/debaryadas/2321803
Git : git clone --branch 7.x-1.x http://git.drupal.org/sandbox/debaryadas/2321803.git autocomplete_dependent_population
Reviews of other projects
https://www.drupal.org/node/2322511#comment-9061559
https://www.drupal.org/node/2322295#comment-9062455
https://www.drupal.org/node/2322189#comment-9062505
https://www.drupal.org/node/2321907#comment-9062623
https://www.drupal.org/node/2311531#comment-9065737
Comment | File | Size | Author |
---|
Comments
Comment #1
debaryadas CreditAttribution: debaryadas commentedComment #2
debaryadas CreditAttribution: debaryadas commentedComment #3
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxdebaryadas2321803git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
debaryadas CreditAttribution: debaryadas commentedComment #5
debaryadas CreditAttribution: debaryadas commentedComment #6
debaryadas CreditAttribution: debaryadas commentedComment #7
debaryadas CreditAttribution: debaryadas commentedComment #8
debaryadas CreditAttribution: debaryadas commentedComment #9
debaryadas CreditAttribution: debaryadas commentedI am changing the status to "Needs Review" because I have resolved all issues mentioned at
http://pareview.sh/pareview/httpgitdrupalorgsandboxdebaryadas2321803git
The automated test cases have not been included yet since it is not mandatory. I am working on it. I will include it very soon.
With Regards
Debarya Das
Comment #10
debaryadas CreditAttribution: debaryadas commentedComment #11
debaryadas CreditAttribution: debaryadas commentedComment #12
debaryadas CreditAttribution: debaryadas commentedComment #13
potop CreditAttribution: potop commentedI think you should consider creating submodule with your example form.
Otherwise anyone who enables your module gets www.example.com/autocomplete_dependent_test_one url exposing your testing form to every user and there's no way to disable it without disabling the whole module.
Another thing which is not clear from your example is should all possible dependent elements data be returned in every call of autocomplete_dependent_population_test_one_callback() -- which could cause excessive database calls in many scenarios.
And why do you require widget type ('textfield', 'textarea', 'select') to be specified in returned data array, if you can easily determine it by widget name on the clientside?
Comment #14
potop CreditAttribution: potop commentedComment #15
debaryadas CreditAttribution: debaryadas commentedHi potop,
Thanks for reviewing my module and providing valuable suggestions. I will obviously develop an example module which will elaborate the usage of the main module with examples and can be disabled separately.
You do not need to send every possible values from 'autocomplete_dependent_population_test_one_callback'.
It is just an example which shows that every possible form element value can be returned. It is totally dependent on your application and business requirements. You can return a single value or more than that. I am thinking to split this example into separate part to enhance it's usability.
Obviously the widget type can be determined from client side and that is not a complicated task. But my purpose of building this module is to provide a generic way to populate the dependent fields of an autocomplete field without doing any javascript/jquery work. You can use this module for any form and populate the dependent fields without doing any javascript/jquery work. All you need to do is to return elements as specified in the examples.
If you have any other suggestions, you can provide. I will request you to review my module again after the changes.
With Regards
Debarya Das
Comment #16
debaryadas CreditAttribution: debaryadas commentedHi,
Please take update the module from git and review it again. Clear the cache also.
With Regards
Debarya Das
Comment #17
pkamerakodi CreditAttribution: pkamerakodi commentedManual review comments:
Some minor review comments
1) Please add line break before return statments.
2) In autocomplete_dependent_population_process its better to add a isset every where it is accessing the element variable properties to avoid warnings
3) May be in theme function theme_autocomplete_dependee_field you can use drupal7 renderable array concept which way anyone using module can override the theme easily. And moreover output variable is unnecessary there, instead you return the element directly.
4) May it is better to implement hook_requirments and set the check for required library presence.
5) A small drupal standards formatting issue js doesnot follow 2 spaces per tab setting. Apart from that there are some formating issue like space after if etc.
For ex as below
jQuery.each(response['data'], function(index , value) {
cust_id[count] = index;
count ++;
});
6) And also could please try modularizing the js code since it is difficult to understand.
Please let me know if you need more info.
Regards,
Prajwal
Comment #18
pkamerakodi CreditAttribution: pkamerakodi commentedComment #19
debaryadas CreditAttribution: debaryadas commentedHi Prajwal,
Thanks for your detailed review of my project. Here are the changes
1] Done.
2] Done.
3] hook_element_info already provides a prepackaged default render arrays. So does it really
needed to build a renderable array inside theme function theme_autocomplete_dependee_field.
If you explain it then it will be better.
4] Done.
5] I have checked that Drupal suggests indentation with 2 spaces(https://www.drupal.org/node/172169#indenting) .
Moreover, Drupal javascript coding standards mentions "Control statements MUST have one space between the control
keyword and opening parenthesis, to distinguish them from function calls." (https://www.drupal.org/node/172169#structures).
It will be helpful if you suggest how to test javascript formatting.
I have changed the variable declaration format for few variables for javascript(like keyup_fields is modified to keyupFields)
6] The functionality is dependent on JS code. So it is not possible to modularize JS code totally. But I
will consider re-organizing code to reduce complexity if possible.
Any more suggestions will be helpful.
With Regards
Debarya
Comment #20
ram0108 CreditAttribution: ram0108 commentedHello Debarya,
Thank for your contribution.
At the time of module installation i am getting following errors.
1 - Notice: Undefined offset: 0 in autocomplete_dependent_population_requirements() (line 16 of /opt/lampp/htdocs/drupal/sites/all/modules/autocomplete_dependent_population/autocomplete_dependent_population.install).
2- Jquery UI Autocomplete is not available.
If There is any kind of dependency on Jquery UI Autocomplete, Then you must describe it on requirement doc as well as info file.
Thanks!!
Comment #21
ram0108 CreditAttribution: ram0108 commentedPlease fix these two issue mentioned in previous comments.
Comment #22
debaryadas CreditAttribution: debaryadas commentedHi ram,
Thanks for your help in detecting the issue. I have added additional code to prevent the errors. Few things that I want to mention is the following:
This module is dependent over misc/ui/jquery.ui.autocomplete.min.js which is shipped with drupal core. So there is less possibility that this file will be unavailable unless tampered/removed in any way. But I have placed a checking for this file inside hook_requirements in the install file. Moreover, is there any way to mention the a particular js file dependency in the .info file?
I request you to check your misc/ui for jquery.ui.autocomplete.min.js at your drupal 7 installation.
It will be helpful if you try again to install the module.
With Regards
Debarya Das
Comment #23
ram0108 CreditAttribution: ram0108 commentedHello Debarya,
If Jquery UI Autocomplete is already available in Drupal core installation then there is no need to put this in info file. however i got error at the time of module installation, may be due to path which you wrote in your code, dont know exactly.
Today i will try again with your module.
Thanks!!
Comment #24
mpdonadioAssigning to myself for next review.
Comment #25
mpdonadioAutomated Review
Review of the 7.x-1.x branch (commit b50e8e0):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review
The formatting in the JS does not meet Drupal coding standards. See https://www.drupal.org/coding-standards
The JS needs more comments to describe what is going on. It is very hard to read.
If jquery.ui.autocomplete.min.js is part of core, why are you checking for it in a hook_requirements()?
You can use #attached for your settings, too, instead of drupal_add_js().
drupal_static is preferred over the native static in PHP.
(+) autocomplete_dependent_population_process will clash with hook_process. You need to rename this.
(+) Avoid linebreaks in translated strings.
(+) Your example menu paths should have access controls on them, 'access content' at the very least.
(+) You have a decent amount of bad formatting. I am not sure why the automated tests didn't pick them up. Read through the coding standards and try to use an IDE that is Drupal coding standard aware (like PhpStorm or Aptana).
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
There are some big things that need to be addressed, but none are critical blockers, so I am setting RTBC. I want a second review by another admin on this because I have a feeling that I may have missed something.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #26
mpdonadioForgot to unassign myself.
Comment #27
debaryadas CreditAttribution: debaryadas commentedHi,
I have resolved issues mentioned in the previous post.
Please take a update from git and review it again.(Clear cache also)
With Regards
Debarya Das
Comment #28
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedAssigning to myself for next review.
Comment #29
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedAutomated Review
Review of the 7.x-1.x branch (commit 06c4901):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review
(+) autocomplete_dependent_population_generate_element(): could you document @return here so that is clear what comes out of this function? See @return: Function return values
(+) autocomplete_dependent_population.js: Some comments length exceeding 80 characters, all comments must be under 80 characters read https://www.drupal.org/node/1354 again.
(+) autocomplete_dependent_population.js: you are encoding this value twice.
var input = Drupal.encodePath(Drupal.checkPlain($.trim($(this).val())));
, I thinkDrupal.encodePath
should be enough.Remove extra space from
count ++;
.Remove extra comma & space from
// Remove the last , from autocompleteDependeeFields.
Project Page: Extend this little bit more, better to go through Tips for a great project page again.
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Not seeing any blocking issues here, also issues mentioned by other admins have been addressed.
Inline comments and code formatting looks good now.
Thanks for your contribution, debaryadas!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #30
debaryadas CreditAttribution: debaryadas commentedHi er.pushpinderrana,
Thanks for reviewing my project . I have made final changes mentioned by you.
Thanks to all the reviewer for reviewing my code.
With Regards
Debarya Das