Simple as that. I can't find straightforward and easy example how to use it, and the place I expected it is here.
Could somebody add this? Like, in confirmation about deleting entries or something?
http://api.drupal.org/api/drupal/modules!system!system.module/function/c...
Seems code from http://api.drupal.org/api/drupal/modules!aggregator!aggregator.admin.inc/7 might be good, but it's not written in a self-explanatory way and I have some irritating doubts and little problems with it.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff.txt | 7.99 KB | mile23 |
| #15 | 1973508_15.patch | 14.68 KB | mile23 |
| #14 | examples-add-confirm-form-1973508-14-do-not-test.patch | 13.88 KB | wolffereast |
| #13 | examples-add-confirm-form-1973508-13-do-not-test.patch | 13.88 KB | wolffereast |
| #11 | examples-add-confirm-form-1973508-11.patch | 13.8 KB | wolffereast |
Comments
Comment #1
mile23Yah, that's a bit of an omission.
I'd say it belongs in the FormAPI module even though it's not officially part of the FormAPI.
Tagging as Novice.
Comment #2
wolffereast commentedI added an 11th example to the form API example module.
This is my first patch so any and all suggestions/revisions/you-did-this-completely-wrong-and-heres-how-to-do-it-differentlys are welcome!
Comment #3
mile23Thanks, wolffereast.
Looks good for a first-timer. :-)
Just a couple things:
We generally don't have comments like that. Thanks for being consistent with the other wrong ones, though. :-)
Missing a few @ingroups.
Comment #4
joachim commentedI'd say just reword that to not specify a number, save having to update this in future! :D
Same here!
Comment #5
wolffereast commentedI've applied most of the changes, I'm just stuck on the ingroup issue.
Mile23 - can you point me in the direction of some ingroup standards? I was following what I found on the comment standards page (https://drupal.org/node/1354#functions) under the 'Form-generating functions' header. Other than the @ingroup form_example what do I need to add?
Comment #6
mile23Docs for @ingroup and @defgroup are here: https://drupal.org/node/1354#defgroup
Most important is this convention: You can @defgroup a group in the .module file, but then you declare @ingroup on functions in other files.
In our case, we want all of the functions to show up on api.drupal.org, so we @ingroup them all. form_example_tutorial_11_submit() doesn't have an @ingroup.
Actually, there are quite a few missing @ingroups in other functions as well.
And.. How could I have overlooked it? No tests! :-)
Attached is #2 with @ingroups added in form_example_tutorial.inc.
Regression tests checking that the menu routing works, and that the confirmation page shows the right name would be great.
Comment #7
mile23OK, needs tests to keep it all green, please.
Comment #8
Mołot commentedI see tests in #6 all green now.
Comment #9
mile23Sorry. I mean it needs regression tests for the future. Regression tests checking that the menu routing works, and that the confirmation page shows the right name would be great.
Comment #10
wolffereast commentedThanks for the link, exactly what I was looking for! I'll take a look at the regression testing when I get a chance, that's new to me as well though so it may take a bit...
Comment #11
wolffereast commentedOnce more unto the breach, dear friends, once more;
I took the patch from 6, changed the comments according to 3 and 4, and added regression testing.
in regards to the regression testing I am not sure if the tests I put in are what you are looking for, I couldn't find a way to test the actual form field on the confirmation page so I added a print message and tested against that. Hopefully that works.
Comment #13
wolffereast commentedAlright, I fixed the initial issue on the test but have run into another problem. I am uploading another patch and marking it to avoid testing so you can see what I am talking about. I am having an issue with my last assertText statement (the 'This is my name' assertion). it is returning false even though I see the appropriate statement outputting when I run through the form by hand.
Any direction would be appreciated!
Comment #14
wolffereast commentedYeesh, forgot to port one my changes to the test document. This doesnt fix the issue, but it does remove one of the things that could have been an issue. Sorry about the extra posts
Comment #15
mile23Fixed the tests, fixed some formatting, added some inline comments...
Also disabled the textfield on the confirmation form. It's good to demo placing form elements within confirm_form(), but the user shouldn't be able to edit the name there.
Comment #17
mile23Aaaaand.... Committed. :-)
Thanks, wolffereast!