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 CiviEvent (Moderator: Yashodha Chaku) »
  • Access selections from first participant on additional participant screens
Pages: [1]

Author Topic: Access selections from first participant on additional participant screens  (Read 344 times)

GinkgoDOB

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 1
  • Dir. of Product Development, Ginkgo Street Labs
    • Ginkgo Street Labs
  • CiviCRM version: v4.5-4.7
  • CMS version: Drupal
Access selections from first participant on additional participant screens
January 04, 2014, 09:40:44 am
 I'm currently using jQuery in the Register.extra.tpl and AdditionalParticipant.extra.tpl template files to show/hide different options in the price set based on selections. I'd like to know - is it possible to access with jQuery the selections that someone registering multiple participants makes on the first participant screen from the additional participant screens? The scenario I have is this

Organization isn't ready to implement CiviDiscount to do membership-based discounts for the events based on the membership status, so I'm left with having to have a participant indicate whether they are a member, or wish to buy a membership during the event registration process. Memberships are for a family/household, so if participant #1 selects "Already a member" or "Purchase a membership," I hide the non-member price set items using jQuery. If they say, "Not at this time" to the membership question, I hide the member pricing.

So far, so good.

I'd like to be able to capture the response to the membership question from the first participant when I'm registering the subsequent participants so I can continue to hide the member or non-member price set items as appropriate for the second and subsequent registrations.

It doesn't seem as though anything is written to the database until the registration is completed for all participants. I could plop a cookie in the browser session, I suppose, but that seems - inelegant.

GinkgoDOB

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 1
  • Dir. of Product Development, Ginkgo Street Labs
    • Ginkgo Street Labs
  • CiviCRM version: v4.5-4.7
  • CMS version: Drupal
Re: Access selections from first participant on additional participant screens
January 05, 2014, 01:38:36 pm
Still looking for an answer to this and I'm wondering if this might be an easy fix. (Forgive me if this is obvious to some of you; I'm flying by the seat of my pants with jQuery coding.)

I found the jQuery Sessionstorage plugin http://plugins.jquery.com/sessionstorage/ which seems to accomplish what I need. I'm going to play with it a bit to see if I can make it do what I need. More information on localStorage and sessionStorage for n00bs like me here http://www.w3schools.com/html/html5_webstorage.asp

I have a related question, though: Looking at the civicrm/packagaes/jquery folder, there's a sub-folder named "plugins". Can I add additional plugins here so they'll be accessible in CiviCRM's embedded jQuery with the "cj" prefix? Is there anywhere else I would need to specify that this JavaScript library get loaded?

GinkgoDOB

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 1
  • Dir. of Product Development, Ginkgo Street Labs
    • Ginkgo Street Labs
  • CiviCRM version: v4.5-4.7
  • CMS version: Drupal
Re: Access selections from first participant on additional participant screens
January 05, 2014, 02:25:31 pm
Pardon the stream-of-consciousness posting.

The jQuery prefix change from $ to cj happens because of a little snippet of code invoking jQuery's "no conflict" feature. Any plugins loaded at the time are subject to the new prefix.

The jQuery plugins are pulled in through the file civicrm/templates/CRM/common/jquery.files.tpl (please note all lower-case directory name "common", which is, in fact, uncommon). I had to modify this file to include the jQuery storage plugin. It does not appear to honor the jquery.files.extra.tpl convention in the custom templates directory.

I was able to store a value on the first participant screen and retrieve it in the additional participant screen. (Woohoo!) And I think this will work around the problem I'm having.

Unless there's a way to accomplish this with the current code base, what are the chances of including this jQuery plugin in future CiviCRM releases?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Access selections from first participant on additional participant screens

This forum was archived on 2017-11-26.