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

Exploratus’s picture

Would love this!

contraverse’s picture

Quick 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')) {

ipwa’s picture

Use the dev version.

escoles’s picture

The 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:

if (!$field.length) {
        return;
}
if ($field.is('input:button,input:checkbox,input:image,input:radio,input:submit,input:checkbox,input:hidden,select,option')) {
        return;
}

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.)

tompagabor’s picture

My answer is change line 21 on compact_forms.js:

if (!$field.length || !$field.is('input:text,input:password,textarea')) {

to this:

if (!$field.length || !$field.is('input:text,input:password,textarea,input[type=email]')) {
drclaw’s picture

Status: Active » Closed (duplicate)

This 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).