Closed (duplicate)
Project:
Compact Forms
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2013 at 19:16 UTC
Updated:
13 Aug 2013 at 04:03 UTC
This seems related to a 6.x version of compact_forms (http://drupal.org/node/1459346) but I am looking for a way for Compact Forms to recognize and support the email field attribute of Webform. The issue that existed with version 6.x is also what's happening with version 7.x: Webform uses a type="email" field instead of a type="text" field now but Compact Forms hasn't been updated to deal with these HTML5 attributes.
Does anyone know of a solution besides making the email field into a plain text field (I'd like to maintain the ability for webform to validate the email field)? Thanks.
Comments
Comment #1
Exploratus commentedWould love this!
Comment #2
contraverse commentedQuick fix.
compact_forms.js, line 21:
if (!$field.length || !$field.is('input:text,input:password,textarea')) {
change to
if (!$field.length || !$field.is('input,textarea')) {
Comment #3
ipwa commentedUse the dev version.
Comment #4
escoles commentedThe javascript edit in #2 will break display of any input that's not some kind of text field.
I initially tried addressing with the following (which does NOT work):
if (!$field.length || !$field.is('input:text,input:email,input:password,textarea')) {This fails interestingly, because it works in some situations and not others: Failed on our server, worked in my local dev environment.
This is what I did instead:
This works for email fields. Instead of looking at what it's NOT, I just looked at what it IS, and tried to identify all the field types I didn't want this applied to. (It might work find for 'select' and 'option', I just didn't even want to try it.)
BTW, my code is only broken out in 2 separate 'if' statements to make the code a little clearer for testing; you should be able to combine them with '||' as in the original.
(Also, this was on 6.x-1.x-dev, though that shouldn't make a diff for the js.)
Comment #5
tompagabor commentedMy answer is change line 21 on compact_forms.js:
to this:
Comment #6
drclaw commentedThis is duplicate of #1459346: Email labels in Webform 3.16+ not processed by compact form -- The solution there is to use the dev version of the module (at least until a new release is pushed).