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 CiviMember (Moderator: Deepak Srivastava) »
  • incorrect choice in price set on membership renewal forms
Pages: [1]

Author Topic: incorrect choice in price set on membership renewal forms  (Read 1961 times)

dsdart

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 3
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.25
  • MySQL version: 5.1.41
  • PHP version: 5.3.1
incorrect choice in price set on membership renewal forms
July 23, 2013, 10:38:49 am
We have an issue where on membership renewal applications, last year's price choice in the price set is not being selected.  We worked around this by having the highest amount listed first and so it is pre-selected on the form.  However, this has caused some problems/complaints with our renewing members, so it needs to be fixed.

I cannot figure out how to fix this so that the correct amount is selected.  Anybody have any suggestions?

dsdart

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 3
  • CiviCRM version: 4.4
  • CMS version: Drupal 7.25
  • MySQL version: 5.1.41
  • PHP version: 5.3.1
Re: incorrect choice in price set on membership renewal forms
July 23, 2013, 12:41:06 pm
In case somebody stumbles upon this and needs help here is what I ended up doing:

1. I added a dummy choice to our price set, moved it to the top of the list and marked it as default (although I don't see an effect of having a default).

2. Created some javascript in files/civicrm/custom/tpl/CRM/Contribute/Form/Contribution/Main.extra.tpl to hide that element  - cj('div.Member_Class-row1').hide();

3. Added a hook_validateForm function to complain to the user if that hidden choice is still selected

function MyCustomModule_CiviCRM_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors )
{
  //drupal_set_message("form name " . $formName);
  if ($formName == 'CRM_Contribute_Form_Contribution_Main') {
    //drupal_set_message("<pre>".print_r($fields,1)."</pre>");
    // hate to hard code this, but looks like the only way
    if ($fields['price_22'] == 68) {
      $form->setElementError('price_22', "Member Class is a required field");;
    }

  }
}

This is really hokey, so if somebody has a better solution, please mention it!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • incorrect choice in price set on membership renewal forms

This forum was archived on 2017-11-26.