Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Dec 2010 at 00:24 UTC
Updated:
21 Jan 2013 at 22:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
becw commentedHere's the patch.
Comment #2
becw commentedThis bug is still present in the latest 7.x-1.x-dev. I've re-rolled the patch so that it applies cleanly.
Comment #3
JacobSingh commentedThis seems like a no-brainer. I don't have time to test right now, but my understanding was that the required property would "just work" and doesn't need to be additionally specified. Is this not the case? If I look in system.module, I don't see it specified in most element_info arrays.
I'm a bit foggy on this area of the code...
Comment #4
becw commentedWhen you're providing your own element type, you have to deal with the #required property yourself: the 'media' FAPI element type gets built out within the media module, and it needs to add the property to its child input elements. (I think that #required isn't inherited by FAPI descendants.)
Comment #5
JacobSingh commented@bec: As always, you rock :)
Committed.
Comment #7
bmcmurray commentedThe default 'fid' of a media input is
'0', that is, zero as a string. This is causing the check in media_element_validate to never catch an empty submission on a required field.Additionally, $element['#title'] appears to be empty regardless of whether the form element has a label set or not, so I've modified the error thrown when a required field isn't found to use:
$form_state['field'][$field_name][$lang]['instance']['label']Patch attached.
Comment #8
azinck commented#7 works for me
Comment #10
azinck commentedThough #7 needs to be re-rolled against the correct directory.
Comment #11
daffie commentedThis patch won't work for a form element with the type set to 'media'.
Comment #12
azinck commenteddaffie: The media field has been deprecated.
Comment #13
dave reidComment #14
daffie commented@azinck: Thank you for the info. I have switched back to 7.x-1.x. I am following Media gallery to see how they will solve this problem.
Comment #15
dddave commentedper #7 and please patch against latest dev.
Comment #16
ParisLiakos commentedI fixed the label part.
Previous commit for another issue accidentally fixed the other part.
marking as fixed.
Comment #18
azinck commentedNot fixed for me. In a multi-value form one of the values that comes through is the text of the "add another" button which is a string, not an array. The existing method of checking for empty fails when it hits this string.
Comment #19
azinck commentedComment #20
ParisLiakos commentedcan you please incorporate your patch in the issue here #1558830: media_element_validate() has hardcoded $form_state values reference and does not work with unlimited
Comment #21
azinck commentedDone.
Comment #22
ParisLiakos commentedawesome, thanks:)