The Webform Field Repeat module enables the webform to remember selected field entries from current submission for up to an hour. It uses the $_SESSION to do so. If the session is active, the form will be populated with selected entries from remembered submission when opened again.
The fields can be selected on Webform >> Form settings for each individual webform. Once the fields has been selected the end users will see a check box at the bottom of the form that they can check to have the form populated when they open the form for a new submission. This module depends on Webform module.
Project's Page: https://drupal.org/sandbox/qudsia.aziz/2023513
Repository: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/qudsia.aziz/2023513.git webform_field_repeat
cd webform_field_repeat
Comments
Comment #1
qudsiaaziz commentedComment #2
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 #3
LoyC commentedAfter installation on clean drupal 7.22, I tried to create new webform and got this error:
Notice: Undefined property: stdClass::$nid in webform_field_repeat_form_alter() (line 70 of /var/www/kristaps/data/www/*****/sites/all/modules/webform_field_repeat/webform_field_repeat.module).
Comment #4
qudsiaaziz commentedThank you, LoyC. It's been fixed now.
Comment #5
federiko_ commentedHello.
I installed the module and it worked as expected.
After reading you code I have some comments :
.info: l.2 : "subimisson" should be "submission"
.module : l.31 You don't need to sanitize contents of node_load()
node_load(check_plain($nid));l.40 >
<a href="' . check_url($GLOBALS['base_url'] . '/node/' . $nid . '?sid=' . $sid) . '">' . t('Go back to the form') . '</a>All internal links output by modules should be generated by l() function.
I didn't check webform_field_repeat.js.
Comment #6
qudsiaaziz commentedHi Federiko,
Thanks for the review. I fixed the things you mentioned.
Best,
Comment #7
afi_amouzou commentedHallo qudsiya,
I install the module and I did not find any major Issue. I have only one suggestion. You use drupal_uninstall_schema('webform_field_repeat'); in webform_field_repeat_uninstall(). This is not necessary in Drupal 7.
Comment #8
qudsiaaziz commentedThanks afi_amouzou. Fixed that.
Comment #9
_timpatrick commentedHi qudsiya,
I installed the module and tested it out, and it seems to work as expected.
Looking over the code everything looks good - no major issues I can see. In addition code review found no issues. Perhaps something that could be added is a header comment to the webform_field_repeat.js file.
Comment #10
qudsiaaziz commentedHi _timpatrick,
Thank you. I added a header comment to the webform_field_repeat.js file.
Comment #11
_timpatrick commentedPerfect - looks good now.
Comment #12
PA robot commentedProject 1: https://drupal.org/node/1832562
Project 2: https://drupal.org/node/2024431
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #13
qudsiaaziz commentedComment #14
svenaas commentedComment #15
agentrickardBumping for review again. One of the three applications should be approved.
Comment #16
dman commentedI'll look at this now in the Project applications sprint
Comment #17
dman commentedI was a little unclear from reading the project page about whether this provides "multiple values" in webform fields (which I believe is currently lacking, and would be a good feature) - or .. something else that gets triggered when re-editing a form, as the project page seems to imply.
Hopefully that will become clear, but if there is an answer, I'd like to see that on the project page.
Functionally, I think that support for webform select fields (at least) is currently missing. This may be because it's a select, or because I chose to nest it in a fieldset.
Are all core webform fields expected to work? If not, please note that as a limitation.
I could not see how to change the text "go back to the form". I'd expect to be able to change it to "Please make another submission" or something through the UI provided. Not least because "Go back" implies that you are going back to what you just did, not starting a new submission, which is actually what happens.
---------------
CODE review.
Seeing as you describe the data as only lasting an hour anyway... wouldn't this function work better (for anon if nothing else) by using $_SESSION ?
I'm glad you identify the issue. really ... but can't you find a way to eliminate it? EDIT: on code review I see you also filter by remote_addr. So I guess that's not so bad. Perhaps the README could explain that.
You must use Drupal.behaviors to add event handlers otherwise your code will clash with overlay, AJAX and other js widgets on the page in weird and wonderful and frustrating ways.
You must also use the funky
for jquery namespacing. See the examples in core /misc folder or any other Drupal module.
Please use url() for this. $GLOBALS is always a warning sign.
.. for that matter, it seems you use l() later anyway, so that is supposed to take care of that for you.
looks a bit awkward (it's unthemable) ... but I'll let it slide.
Needs better description. What does it actually do?
_alter hooks are one of the hardest things to trace when debugging Drupal. PLEASE tell us what you are actually doing to our forms! The code inside there does not clarify what it's doing.
You should normally instead use FAPI #attached
You will find that your js does not load if you submit this form and validation fails - you js will not turn up on the second page. This is almost trivial in this case, but useful to know when building forms.
With all this, (though the only real blocker is the drupal-incompatible jquery) I find it hard to agree with the RTBC tag ... I'm opening it up for a third opinion.
Comment #18
dman commentedI'll leave this open - anyone can promote. I don't see blockers, but I'm not confident about the non-use of webform APIs either.
Comment #19
kscheirerComment #20
kscheirerYou have a couple of errors regarding unused variables here: http://pareview.sh/pareview/httpgitdrupalorgsandboxqudsiaaziz2023513git. You should also remove the .gitignore file. We don't use logical "and", use && instead.
In webform_field_repeat_form_submit() don't delete and then insert rows, you can use db_merge() instead. Because of
if ($field['#type'] == "checkbox" and $field['#checked'] == TRUE) { ... }does that mean this module only works for checkboxes?You could use a more detailed project page - when would I want to use this module? Can you attach screenshots?
I think you need a security warning about IP addresses on the project page as well - it's possible that 2 different users share the same IP address, and they might see each others' results.
Edit: I just read dman's review, many excellent points there as well.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #21
qudsiaaziz commentedThank you dman for excellent suggestions.
I have made the following changes.
2. I am using $_SESSION now.
3. Added some more description.
4. Removed cid indexes.
5. webform_field_repeat.js is not needed now and is removed.
6. 7. 8. These codes blocks are not needed now and have been removed.
10. I tried to add more comments in the function body.
11. I am using webform_get_submission instead.
12. No javascript is being used now.
13. Tried to add more comments.
Comment #22
qudsiaaziz commentedThank you kscheirer!
I fixed the errors pareview found.
No. I am just representing the form fields names as checkboxes in webform settings so that they can be selected/deselected to allow/deny repetition if the user checks the remember me at the bottom of the webform.
I will post the screen shots.
On the security warning about IP addresses:
I am using $_SESSION now and I have added a security warning about the anonymous users session on shared computers.
Comment #22.0
qudsiaaziz commentedUpdated the repository link.
Comment #22.1
qudsiaaziz commentedNew project description added.
Comment #23
kscheirerYou can remove .gitignore.
In webform_field_repeat_form_alter(), the sql query does not need to select nid.
Looks great! I'll move it along to RTBC, but the project page really needs some help.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #24
qudsiaaziz commentedThank you kscheirer!
I removed .gitignore and fixed the sql query in webform_field_repeat_form_alter().
I have added some screen shots to project page on https://drupal.org/sandbox/qudsia.aziz/2023513. I am not completely happy with how they look right now.
I'll try to create a separate project tutorial page on drupal.org.
Comment #24.0
qudsiaaziz commentedProject description change
Comment #25
kscheirerIt's been a month without any problems reported, so I'm promoting this myself as per https://drupal.org/node/1125818.
Thanks for your contribution, qudsiya!
I updated your account to let you 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 get 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.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #27
avpaderno