This module provides integration between the parsley.js client side form validation and the drupal FAPI layer.
At the moment it's very much a developers module as there is no admin interface, however integration with webform and the ability to indicate forms is a goal for future versions.
It integrates on the form_alter level and injects html data attributes. Currently it uses no custom JS at all and only affects the DOM elements of a form.
Similar modules
Clientside Validation
The biggest difference is that Clientside Validation uses jquery validate whilst the parsley.js module uses parsley.js. My module is a lot more lightweight which is a primary goal.
Project page:
https://drupal.org/sandbox/botto/2140265
Parreview
http://pareview.sh/pareview/httpgitdrupalorgsandboxbotto2140265git
Not sure why it's picking up README.txt ^
Git clone
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/botto/2140265.git parsley_js
Other reviews by me:
https://drupal.org/node/2266081
https://drupal.org/node/2267557
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | is_array_check-2273733-11.patch | 938 bytes | valderama |
Comments
Comment #1
PA robot commentedWe 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 #2
lonaloreHi,
Some errors can be easily fixed in README.txt.
Fix:
The lines are too long. Maximum of 80 characters per line is allowed.
Fix:
Fix:
Comment #3
lonaloreComment #4
Botto commented@Lóna Lore thank you for the review, I fixed the 3 README.txt issues
I also realized I had not documented the dependency on jquery_update, this is also now corrected
Comment #5
lonaloreHi,
I noticed that Parsley.js requires least version 1.6 of jQuery. So you could check the current version of jQuery in hook_requirements(), like this:
Comment #6
eft commentedInteresting module. You state that it is a lot more lightweight than a similar module, Clientside Validation. In what way is it more lightweight? Presumably not the js itself because jquery.validate appears to be a smaller file than parsley.js. The most recent version of parsley.js is even larger.
I would include a link to parsleyjs.org, so that prospective users of your module can more quickly assess the parsley.js library.
Parsely.js seems to be rapidly evolving and 2.0.0 was released in April. I don't know how much effort it would be for you to ensure your module is compatible with 2.0.0 but all the docs and downloads on parsleyjs.org are for the latest version. [Note: I see you have it on your list under Todo and you specifically reference the version your module is compatible with in your .module file.]
There are a few typos in your project page and project files:
-- On the sandbox page...
- under Usage, you might want to include some inline documentation that makes it clear the return array comprises form ids.
- under Rules "same rule name as the parsley.js documentation"
-- parsley_js.api.php
- "Hook to
oset which forms will have the parsley.js validation on them"-- parsley_js.info
- maybe use a more explanatory name like "Parsley Validation"
- suggest you change description to "Enables developers to integrate the parsley.js client-side validation library with forms"
-- parsley_js.install
- "Provides the requirements, install and uninstall functions for parsley_js"
-- parsley_js.module
- "Currently supports parsley.js 1.x"
- "Declaring the parsley_js_form hook..."
- "First check whether the there is a cache entry"
- "The rule with either params or no params, it follows the parsley.js syntax
- "The rules [space] tring parsed from #rules"
- "@see http://parsleyjs.org/documentation.html#basic-constraints" should be "@see http://parsleyjs.github.io/Parsley-1.x/documentation.html#basic-constraints"
Are you sure that jQuery 1.9 is required? The higher the version of jQuery you require the higher the potential for conflicts with other modules that may not be compatible with that recent a version of jQuery. This test for jquery version might be more versatile:
Comment #7
joachim commentedSetting to needs work based on above comments.
A few of my own...
This seems like a really weird way round. You're already implementing hook_form_alter(), so why not detect a property in the $form_state array, say $form_state['parsley_validation'] = TRUE?
You mean https://drupal.org/project/FAPI ?
You only use this constant once, and never check for the return value. What's it for?
> At it's core it's simply injects the correct attributes into the relevant FAPI
Typos. "At its core, it ... "
> 2. jQuery Update (Tested with jQuery 1.9, millage may vary with earlier
Mileage.
The README maybe needs a run through a spellchecker?
Interesting module! Might use it in my projects when it gets a stable release :)
Comment #8
Botto commentedThank you for the reviews. I have fixed the spelling mistakes and added some more info under .info file and the project page.
I have not started on the 2.0 version yet however I thought the module could track the same major version number. I'm not sure if there will be much difference in integrating the new version or not.
It will probably be the next task after I get the module to a full project status.
I removed the NOT_FOUND, this was a mistake in the end as I want it to coexist with FAPI module, if there was a rule the FAPI module understands but parsley.js does not it would have caused errors.
Used a hook simply because that was how I thought up the module to begin with, I agree there is no reason to use it and using a form key will actually make it easier for other aspects. I will make that change.
Comment #9
Botto commentedComment #10
Botto commentedI've updated the module to now pick up
$form['#parlsey_js'] = TRUE;instead of using a hook to declare the forms. All the relevant docs should be updated to reflect this.Comment #11
valderama commentedHi botto,
The overall impression of your module is very good to me.
I have tried to add a validation rule to a node form on the title, which worked after a few tweaks.
First, I had to adjust the module weight of parsley_js to run after my custom module. You should consider giving you module a weight by default, and/or add a note the README which explains the situation.
Second, I had a fatal error because not every element in the node $form array is an array. This can easily be fixed by an is_array check - I have a patch attached with this change.
As I final remark I would strongly encourage you to add an parsley_js_example module, which showcases most (or even all?) validations on an example form. this would allow easy testing of the module and also developers can easily copy/paste rules.
PS: I would be glad about a review of my project application here: https://drupal.org/node/2288389
Comment #12
Botto commented@valderama Thank you for the patch, I've applied that.
I also have added an example submodule for devs to use.
I'm not sure why you would need to change the weight considering the module uses a hook. The only time I could see need to change the weight is if you were using another alter to add the rules.
Comment #13
subhojit777Fix these pareview errors: http://pareview.sh/pareview/httpgitdrupalorgsandboxbotto2140265git
I did a manual review and your seems alright.
Installed your module and found several issues. I tested this module in Drupal 7.30. Downloaded the library in libraries directory, but it was unable to detect the library and status report was showing error that it cannot find library. I have kept the library inside
sites/all/libraries/parsleyjs. Also It was unable to detect jQuery version, jquery version was set to 1.10 but it was showing error. Tried clearing cache but did not worked.- You should provide options in field settings to enable field validation using parsleyjs, as user would want a UI setting rather than enabling validation by writing code. Or even better, provide an admin configuration where admin can select whether they want site wide form validation handled by parsleyjs.
- You should provide the link for example parsleyjs validation somewhere, somewhere in help or module configuration would be good.
Comment #14
Botto commented@subhojit777
Thank you for looking at the module.
The parreview are for readme.txt which include some php snippets. Not the actual module itself
The issues you are referring to I assume are because you used version 2 of the library and not version 1, I have clarified this in the status page and the readme. Version 2 support is already in a branch, just needs some cleanup to work correctly.
The jQuery_update issue is because I was unaware that jQuery_update simply assumed 1.10 when the var was not set, a bit strange, but there you go.
I've updated the example(that was already included) to put a menu link item on the admin pane.
As far as adding UI pieces to the module, that is planned further down the road and is not required for the module to be accepted.
Comment #15
sandeep.kumbhatil commentedAutomated Review
Best practice issues identified by pareview.sh
Manual Review
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.
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 #16
Botto commentedThank you @sandeep.kumbhatil
Removed the php tags in the README.txt file
It passes pareview now http://pareview.sh/pareview/httpgitdrupalorgsandboxbotto2140265git
Comment #17
klausiSorry for the delay. Make sure to review more project applications and complete your review bonus and this will get finished faster.
Review of the 7.x-1.x branch (commit 5594f49):
But otherwise looks RTBC to me.
Assigning to stBorchet as he might have time to take a final look at this.
Comment #18
stborchertThanks for your contribution!
Looks good to me.
In addition to Klausi's notes I would highly recommend using element_children() to loop through the form elements. I've tried to add parsley-rules to a node form but this isn't possible since only the first level of the form hierarchy is scanned.
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 #19
Botto commented@stBorchert Fantastic, I will change it to element_children
Thanks to all the reviewers