Drupal 5.1
Required feature

I am very new to using this module. So if I do not understand something correctly, please correct me.

I followed your Doc example to the letter. (and thank you for all the work you did on buidling that tutorial - this module uses up some major brain cells learning it - there are so many great features) However, I believe I found an oversight and a bug while building the example.

Oversight:
The Container Sources and Topics should be ‘Required’ fields in the example. This way the User can not forget to select a value for the Nodes. A new user could easily over look tagging the Node. I find this especially true with Drupal v5 … where the Categories are collapsed and the Select boxes are not visible to the user. In the example, it could be very possible to have a lot of Nodes with no categories assigned.

Bug.
Making these ‘Required’ reveals a small bug. If you make Sources ‘required’, everything is find – because there is only one choice for each – and that’s either Blogs or News – so the proper category is assigned.

But for Topics, there are 3 choices and making this ‘required’ the program selects the first choice in the list (entertainment) if the User does not intervene. It should probably tell the User to make a choice, instead of grabbing the first in the list.

best regards and thanks

Comments

JirkaRybka’s picture

Status: Active » Needs review
StatusFileSize
new2.3 KB

To the "Bug" part:

This is exactly my problem: On our site we have set the Containers to Required status, but as stated above - the selection on nodes is hidden in a collapsed fieldset, and contains no "empty" value, so it defaults to the first Category in the list, and nodes are frequently submitted this way. This is clearly wrong.

I created a patch for this: In the non-required case, nothing changes. But if Required is set, my version replaces the "" item with a message "Select category", rather than removing it, so that selection defaults to this line and not any of the categories. Later on, if user submits without explicitly choosing a category, a new code in the form-validation catches it, and sets proper error on the form-item. So Drupal shows error message to the user, asking him to choose a category.

Additionaly, I changed the fieldset to be expanded by default, because Category-selection should always be considered while creating a node, so there's no point hiding it.

Patch attached.

bdragon’s picture

Patch committed to DRUPAL-5 and HEAD.
Thanks.

bdragon’s picture

Status: Needs review » Fixed

Changing state.

JirkaRybka’s picture

StatusFileSize
new2.32 KB

Oops, just removed a little bug from my patch. Ignore the one above, please, I'm attaching correct version now.

JirkaRybka’s picture

Status: Fixed » Reviewed & tested by the community

Sorry, I didn't expect you to be so fast. Please note my little debug, the first patch didn't work well on Forums.

bdragon’s picture

Heh heh.
I'm subscribed to the entire issue queue.
Reintegrating patch now...

bdragon’s picture

Status: Reviewed & tested by the community » Active

OK, fixed.

By the way, do you have a cvs account? ;-)

JirkaRybka’s picture

:-) No, I've no CVS account, and I'm not going to apply for one. Currently I'm updating my first-and-only site to 5.1, bumping into bugs all around the modules... So trying to correct everything I can, and throwing patches back to Drupal.org where it seems fitting. But this all is just a temporary burst of activity, otherwise I'm more-than-fully absorbed by running the site content-wise. I don't expect having time to do this stuff, once my update is finished.

JirkaRybka’s picture

Status: Active » Fixed

Changing status, by the way.

bdragon’s picture

Status: Fixed » Active

Fair 'nuff.
Thanks for the patches!

bdragon’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)