Text fields work, what about select lists?
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | compact_forms-compact_select_lists-1241808-17.patch | 988 bytes | weinewmode |
| #16 | i1241808-placeholders-and-select.patch | 4.85 KB | jelle_s |
| #15 | i1241808-15.patch | 4.33 KB | attiks |
| #12 | compact_forms-compact_select_lists-1241808-12.patch | 6.59 KB | grasmash |
| #11 | compact_forms-compact_select_lists-1241808-11.patch | 6.09 KB | grasmash |
Comments
Comment #1
greenavus commentedSame here. I would like the select list title to be shown instead of none.
Comment #2
Jarviss commentedLabels inside compact select lists. Works fine with Drupal 7.10, Drupal 7.12
Best to see it included in Compact forms 7, because now it makes labels inside any Select List,
in compact forms there is a way to provide ID of forms to apply compact forms!
Comment #3
Jarviss commented+ Views 7.x-3.1 select filters works fine
Comment #4
johnvThis is nice!
I created this as a patch (SVN-style, since no D7-git provided yet), So I can include it in the current module.
Some first remarks?
- It works for all forms, so not only for the activated forms by ComactForms?
- The textfields have italic labels, Select lists not.
But perhaps it works better on its own?
Comment #5
johnvHere is my modificated module. I got errors with range fields like Date.
Comment #6
wbobeirne commentedAttaching a patch that fixes an error that pops up if the #language index is not set on a form.
Comment #7
grasmash commentedAdding a git patch. This is rolled against the git repo.
Also, I've added an option on the admin settings page so that "compact select lists" can be enabled or disabled.
I've modified the code a significant amount in the interest of improving readability, which is a Drupal coding standards priority.
This patch should be tested against various types of forms and form elements.
Comment #8
grasmash commentedJust realized that the patch actually modifies all forms, not just those specified for compact forms. Going to update.
Comment #9
grasmash commentedOk, updated patch. I had to move some code around to create a new compact_forms_check_form_id() function, which is now shared by the pre_render handler and the select element handlers.
I'm still not sure that this is an ideal patch-- I worked off of the code that was contributed earlier in this thread. However, I think that this should ideally use compact_forms_pre_render() to perform all form modifications, rather than implementing additional hooks. I'll consider refactoring again.
Comment #10
grasmash commentedforgot to attach!
Comment #11
grasmash commentedAlright-- massively simplified. This method mimics the original functionality. Only one issue with the patch at the moment-- no 'required' star is being appended to the select list form element when "Leave star after the label" is set.
Comment #12
grasmash commentedAlright, that's enough for me. Here's a patch that takes care of the asterisk.
I'm not sure what the preferred functionality would be. You could append an asterisk after the selected option by modifying compact_forms.js, e.g.:
However, I'm pretty sure that placing a
<span>within an<option>is invalid HTML. So I went with adding a simple asterisk:Comment #13
johnvI implemented #12.
1. for every select list , the following message appears: "Notice: Undefined index: #title in _compact_forms_resize_fields() (line 139 of ..\compact_forms.module)."
2. the title of each select list just disappears.
3. Support for Views Exposed Forms is lost as of #11, since hook_form_views_exposed_form_alter() is not included anymore.
4. I find the following this a bit awkward. Did you somewhere switch the meaning of $desctiptions ?
Comment #14
johnvAlso, these classes stil lneed to be added to the changed label/first option:
$label.parent().addClass('compact-form-wrapper');
$label.addClass('compact-form-label');
$field.addClass('compact-form-field');
Comment #15
attiks commentedAlternative approach using only javascript
Comment #16
jelle_sPatch in combination with patch from #669878: Support for HTML5 placeholder attribute
Comment #17
weinewmode commenteda simplified patch to the latest version (revision: 0890d60e, branch: 7.x-1.x).