Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
5.x-1.6
Component:
nodereference.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jul 2007 at 04:06 UTC
Updated:
21 Aug 2008 at 21:33 UTC
Jump to comment: Most recent file
Comments
Comment #1
ezra-g commentedI agree that when a nodereference field is required, that the node form should validate only when a valid node has been referenced. In my opinion, when a field is required, two things should be true:
1) The field should contain data
2) That data should be the appropriate type of data for the field. In the case of the integer field, only integers are accepted.
Comment #2
ezra-g commentedWith this patch, nodereference performs a form_set_error when the nodereference field is required and no valid node has been referenced. The error message reads "Please reference a valid post." which might not be ideal for all use cases. Perhaps it would be better to make this this error message configurable on a per-field basis. At least it's run through the t() function.
Comment #3
zmove commentedThe module should provide 2 options for the case a node reference don't match :
I'm working on 3 module right now so I don't have time to create a patch for the second case, but it could be goot to find these option in nodereference core.
Comment #4
wrunt commentedUsing $error_field doesn't work when a valid node wasn't found. The above patch doesn't highlight the field in red when an invalid node title is referenced (at least not for me).
This patch works for me but may have problems when a field has multiple items.
Comment #5
wrunt commentedActually, I think ezra-g's patch was right, I was just misreading it. My patch was for nodereference_field('validate', ...), whereas ezra-g's patch is for nodereference_widget('validate', ...). Doing it in the widget works better.
Comment #6
marcoBauli commentedsame problem here, patch at #4 applies and works great, thanks ;)
Comment #7
gustav commentedI feel that the user should be alerted when they have entered a non-existent title, no matter whether the field is required or not. This patch provides an error message for each autocomplete nodereference field that contains an incorrect title. It does that inside nodereference_widget() which, as wrunt pointed out, is the best place for this.
Comment #8
ezra-g commentedI agree with #7, but I thought wrunt said in #5 that nodereference_widget() was in fact the preferred function.
Comment #9
gustav commentedezra-g, what you write agrees with what I wrote: the best place to set the message is in nodereference_widget.
Comment #10
ezra-g commentedPardon me - I misread that.
Comment #11
nicolash commentedOut of interest...could someone briefly explain why it works better in the _widget hook than in the _field one?
I have a few custom CCK fields, all with some sort of validation and conditional display rules...but for the life of me I can't decide where to put them...there's plenty of places where it'll work...but it seems a bit arbitrary.
Comment #12
nico_ commentedCheers gustav,
thanks a lot for the patch. Works fine for me as well! I hope the patch will in one way or another be included in a future version of the module..
Comment #13
gustav commentedHi Cynic, thanks for your feedback. In response to this I have changed the status to "reviewed and tested by the community". It is really a very simple patch.
Comment #14
yched commentedI fixed that in D6 a few days ago, and thus backported to D5 instead - only slightly different patch (we accept a match on the exact title).
Comment #15
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #16
yched commentedgot fixed meanwhile in D5 and D6
(D5 is only in 5.x-1.x-dev for now)
Comment #17
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.