Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I don´t know if this is the best approach, but with new dev version of Webform, Compact Form does not work with email input fields, because of the new HTML5 support.
I´ve changed compact_form.js at line 21 from:
if (!$field.length || !$field.is('input:text,input:password,textarea')) {
to:
if (!$field.length || !$field.is('input:text,input:password,textarea, [type=email], [type=tel], [type=url], [type=number], [type=range], [type=date], [type=time], [type=datetime], [type=datetime-local], [type=month], [type=week], [type=color], [type=search]')) {
and it solved the problem. What do you think?
Comment | File | Size | Author |
---|---|---|---|
#17 | html5-fields-1405834-17.patch | 900 bytes | unknownterritory |
#8 | html5_fields-1405834-8.patch | 805 bytes | BWPanda |
#5 | compact_forms-html5fix-1405834-5.patch | 766 bytes | ShaneOnABike |
Comments
Comment #1
laraz CreditAttribution: laraz commentedI use your solution. thanks.
Comment #2
DrupalKing CreditAttribution: DrupalKing commentedWorked for me too
Comment #3
rimen CreditAttribution: rimen commentedI used this solution for some types like search and other. You list more complete.
Thanks!
Comment #4
grasmash CreditAttribution: grasmash commentedThis change worked for me as well.
Comment #5
ShaneOnABike CreditAttribution: ShaneOnABike commentedWow! Great work I pushed that into a proper patch and attached that here for people to apply appropriate. Would be great if we could deploy this in the module to be used.
Comment #6
ShaneOnABike CreditAttribution: ShaneOnABike commentedComment #7
yannickooPatch works fine so let's mark this as RTBC.
Comment #8
BWPanda CreditAttribution: BWPanda commentedThe patch from #5 is back-to-front; it removes the new code and adds the old...
Here's an updated patch to fix that.
Comment #9
ckrinaThe #8 patch aplied cleanly for me on dev version. Thanks!
Comment #10
xurizaemonThis is good IMO. Duplicated @ #1459346: Email labels in Webform 3.16+ not processed by compact form but the fix there is not as complete as this, so this should be backported IMO.
Comment #11
yannickooMarked #1459346: Email labels in Webform 3.16+ not processed by compact form as duplicate.
Comment #12
ancym CreditAttribution: ancym commentedAny other progress with this?
Couldn't apply the patch in #8 against the 7.x-1.0+3-dev release from sept 30,2013. (Error was something like Hunk Fail line 18.)
When I tried to manually edit compact_forms.js, the user login block, which had been correctly displayed via compact forms, went back to its original state. The line to modify has been revised from that mentioned in #8 to
line 20
if (!$field.length || !$field.is('input:text,input:password,textarea,input[type=email]')) {
Note, used simplecorp theme since user login wasn't displaying compact-ly for other themes I tried (bamboo, openframework). Didn't work for webform in any of the themes I tried - perhaps a config error, tho i tried to include it for webform_client_form and for webform_client_form_nid.
Looks great when it works! Would love to have a working version.
(edit: The dev version is working for user login block for skeleton and simplecorp themes. No luck with Webform 7.x-3.19.)
Comment #13
FiNeX CreditAttribution: FiNeX commentedHi, I've just wrote a similar patch to fix this problem. I've not tested with webforms but with core node edit form it works fine.
Comment #14
ancym CreditAttribution: ancym commentedYeah, manually changed compact_forms.js according to patch in #8 and works perfectly in webform, great & thanks!
edit: went back and checked and the dev version of compact_forms.js works as is...
(helps to have the correct css id for the webform, oops and sorry for any confusion)
Comment #15
xurizaemon@ancym, Drush applies the patch to current 7.x-1.x-dev for me. In Drush makefile we have
Setting back to RTBC (status previous to #12) since I can't reproduce the issue mentioned above
If anyone *can* repro that or (better) can repro it *and* update the patch resolving the issue you're experiencing, that would be much appreciated.
Comment #16
mErilainen CreditAttribution: mErilainen commentedWorks fine, please commit
Comment #17
unknownterritory CreditAttribution: unknownterritory as a volunteer commentedAvailable patches do not play well with drush make as it adds automatically drupal's packaging information. The packaging info changes line numbering thus rendering the patches unusable. More info.
Uploading a patch created against a working copy of the module downloaded with the packaging info included in order to allow patch referencing in drush make files. This patch is otherwise in all things an exact copy of #8 : html5_fields-1405834-8.patch.
Comment #18
firewaller CreditAttribution: firewaller commentedPatch #8 still works for me. Can this get committed?