CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM generates unbalanced <div>...</div> on Drupal user registration page
Pages: [1]

Author Topic: CiviCRM generates unbalanced <div>...</div> on Drupal user registration page  (Read 3221 times)

rjlang

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 1
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3.19
CiviCRM generates unbalanced <div>...</div> on Drupal user registration page
July 20, 2013, 08:07:30 pm
Using Drupal 7 + CiviCRM 4.3.5

CiviCRM generates unbalanced <div>...</div> HTML on the Drupal user registration page if you include a Profile on the user registration form.

In fact, the unbalancing depends on the number of profiles you put on the form:
  With one profile, there is one extra </div>,
  With two profiles, they balance,
  With three profiles, there is one extra <div>,
  and so forth.
 
That it's CiviCRM can be pinned down by doing the following. In file civicrm.module, function civicrm_form_alter(), case 'user_register_form', just after the call $output = civicrm_register_data(...), dump the value of $output, which contains the CiviCRM-generated HTML. One can count <div>'s and </div>'s in the CiviCRM-generated markup to verify the mismatch.

This code is generated by file CRM/Profile/Form/Dynamic.tpl. So that's where the error lies. But the Smarty logic is a little complicated, so I haven't  figured out the root cause. But I thought I'd flag it.

MaartenS

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7
  • MySQL version: 5.6
  • PHP version: 5.3.5
Re: CiviCRM generates unbalanced <div>...</div> on Drupal user registration page
July 23, 2013, 05:06:10 am
I can confirm this. For three profiles, there is one extra <div, without </div. Also there are three <fieldset, but only one closing </fieldset (which renders ugly, at least in Opera and Chrome).

The problem indeed seems to be in CRM/Profile/Form/Dynamic.tpl
So far I can figure out, the problem must be somewhere around lines 122-142 (only occurences of <fieldset en one of the two </fieldset occurences).

This file however is different from the file in the SVN repository at trunk/templates/CRM/Profile/Form/Dynamic.tpl
The latest changes to this file are from 23 februari 2013:

$ svn log templates/CRM/Profile/Form/Dynamic.tpl --limit=1
------------------------------------------------------------------------
r45813 | lobo | 2013-02-23 02:58:45 +0100 (za, 23 feb 2013) | 1 line

fix formatting and typos
------------------------------------------------------------------------

When I replace the release template with the template file from svn, at least the fieldset tags are balanced (though the div tags still aren't).

Sophie.SK

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: Various
  • CMS version: Drupal
Re: CiviCRM generates unbalanced <div>...</div> on Drupal user registration page
October 15, 2013, 04:47:22 am
Can confirm we have had this problem on three or four different sites now.

I've submitted a patch here: http://issues.civicrm.org/jira/browse/CRM-13592 for anyone interested.
Circle Interactive

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM generates unbalanced <div>...</div> on Drupal user registration page

This forum was archived on 2017-11-26.