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) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Template
Pages: [1]

Author Topic: Template  (Read 509 times)

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Template
November 19, 2013, 03:17:51 pm
Hello,

I'm trying to add a field to an existing form. The field is appearing on the form, but some of the html is being stripped from it.

The simplified version is the following:

Code: [Select]
function membership_civicrm_buildForm( $formName, &$form ) {
if ($formName == 'CRM_Member_Form_MembershipType') {
_membership_add_valid_checkbox($form);
}
}

function _membership_add_valid_checkbox(&$form) {
  $form->addElement('checkbox', 'is_valid_membership', 'Valid Membership?');
  CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Member/Form/MembershipTypeExtension.tpl'));
}


And the template looks like this:

Code: [Select]
<tr class="crm-membership-type-form-block-is_valid_membership">
<td class="label"><label for="is_valid_membership">Is Valid?</label></td>
<td>{$form.is_valid_membership.html}</td>
</tr>

On the form, it renders as this:

Code: [Select]
<label for="is_valid_membership">Is Valid?</label>
<input id="is_valid_membership" name="is_valid_membership" type="checkbox" value="1" class="form-checkbox" />

Any idea what might be stripping out the <tr> and <td> tags?


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Template
November 19, 2013, 10:33:33 pm
Check the page source, not firebug it might be it's stripped on display because it's outside of a table.

Try adding a table tag around, and use jquery to move your tr at the place you want
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Re: Template
November 20, 2013, 06:24:44 am
Thanks xavier! Adding the table tag did the trick.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Template

This forum was archived on 2017-11-26.