Closed (fixed)
Project:
Phone
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
27 Feb 2013 at 04:25 UTC
Updated:
23 Apr 2013 at 00:10 UTC
Jump to comment: Most recent file
I just noticed that if the field is made required, then due to the way the module doesn't add a #title to the actual "number" component, you just get a nice red box with no message as to what was going on.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | phone-required-error-1928662-6.patch | 2.3 KB | cdale |
| #5 | phone-required-error-1928662-5.patch | 2.27 KB | cdale |
| #4 | phone-required-error-1928662-4.patch | 2.26 KB | cdale |
| #1 | phone-libphonenumber-required-error-issue.patch | 752 bytes | cdale |
Comments
Comment #1
cdale commentedHere's a patch that corrects the issue, though, I'm not sure if we need to do more to support phone usage as a stand alone FAPI element. Thoughts? How would this normally be solved?
Comment #2
cdale commentedAbove patch is broken. Working on a fix.
Comment #3
cdale commentedComment #4
cdale commentedUpdated patch. I think this is a better approach, and solves the issue.
Comment #5
cdale commentedOne of those days. Couldn't sworn I added the !empty($error) check....
Comment #6
cdale commentedDefinitely one of those days...
Comment #7
Nephele commentedJust to quickly chime in with a different option. It's possible to provide a '#title' to the original element, but then specify '#title_display' => 'invisible'. That makes the title not appear on the edit form, but yet be available for error messages. I'm not sure whether that ends up being a better alternative.
Comment #8
cdale commentedThat would be ideal, except the $element['#title'] that gets provided to us in hook_widget_form(), is empty when it the cardinality is not 1. So what we get, is no #title, which, we can still output a message but I like the idea of making people aware which field is actually causing the issue, especially if they for some reason have many phone fields on the one form. I.m open to suggestions. I'm not 100% happy with the bubbles code either, but before that, I actually had an if(!empty($element['#title'])) display one message, or show something slightly different otherwise. The only difference, was that one included a name, and one did not.
This does seem somewhat related to a core issue I found, #980144: Issues with "required, multiple" fields in forms. Some of the first patches here make sense, but the final ones look to be rather broken for us, as for example, they remove the "ext" label. There has not been movement in that issue for sometime however.
I'm torn which way to go here, the code currently in place works for all use cases I tried, which I like. It's just a question of whether that is acceptable.
Comment #9
cdale commentedThis has been pushed into sandbox at http://drupalcode.org/sandbox/cdale/1925578.git/commit/3f77061c761161149...
Comment #10
cweagansComment #11
cweagans