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) »
  • Fatal Error: "Could not find valid value for cid" in multiple event registration
Pages: [1]

Author Topic: Fatal Error: "Could not find valid value for cid" in multiple event registration  (Read 5891 times)

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 09:55:21 am
Hi guys,
Have a really bizarre error that I've spent 2 days trying to debug, but to no avail. Hoping someone here might be able to help.
Running civicrm 3.0.3, drupal 6.14.

The issue is that when any CRM user does a contact search (via basic or advanced search) and then selects some search results and chooses 'Add Contacts to Event', the 'add participant' form returns a fatal error "Could not find valid value for cid" at the bottom of the page, and clicking 'save' gives a 'Sorry. A non-recoverable error has occurred' message. It appears to be that the multiple registration form cannot determine the contact ids being passed to it (or they are not being passed to it).
The URLs have the form: /civicrm/contact/search/advanced?_qf_Advanced_display=true&qfKey=3479b5de017879fb64787f8dcc85cc48
Using the standalone participant registration form ( /civicrm/participant/add&reset=1&action=add&context=standalone) works absolutely fine for registering single participants.

This makes it very difficult for our users who are often having to register multiple participants to events in the system in one go.

This functionality worked fine in the original install of the live system, but has started producing this error in the last month or so. I am tearing my hair out trying to work out what could have caused it.

What I have done to try to fix this:
  • Start with a blank new install of v3.0.3 - this works fine, and I was able to add 3 contacts and an event and register them via the search results.
  • I then did a db import of the live data (but with no extra modules or template customisations) into this database. The problem reappeared. So somehow, the data in my live system is breaking this feature...
  • I thought it can't be the actual data (events/contact records doing this), so it must be some config values stored in the db. I deleted all the backend settings by deleting the config_backend field in the civicrm_domain table. The problem is still there, except instead of getting the "Could not find valid value for cid" fatal error, I now get "Could not find valid Key" on the participants add form.

Anyone have any idea what could be causing this?
I have done some extensive google and forum searches but come up with nothing. Others who have had similar messages have been due to permission errors, or front-end registration forms (this is only back-end users). What I don't understand is how this was working originally but seems to have broken itself.

I have also looked at this suggestion: http://forum.civicrm.org/index.php/topic,5701.0.html
and all my database tables are definitely of the correct collation (utf8_general_ci)

I have debugged the CRM\Event\Form\Participant.php to try to trace the source of this error, and having commented out all of the lines in this file and added them back in one by one, the line which the error appears at uncommenting from 0 is line 300:
Code: [Select]
$this->_action = CRM_Utils_Request::retrieve( 'action', 'String', $this, false, 'add' );This retrieves the action value, which using drupal_set_messages is returned as 1.
In fact using the line
Code: [Select]
$this->_action = 1;still produces the error. Now I could be way off with this as I don't know the civi codebase well enough, but that seems to be the offender. Presumably somewhere else in the form class is using this value and not being able to complete something, but why would it only occur for my data, and why would I still get the error when everything after this line is commented out ?
It must be being generated outside this file - perhaps in the core form.php or elsewhere in the page sequence.

Any help/suggestions appreciated (although I won't be able to try them until monday).

Cheers

Graham

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 11:13:08 am

1. does it only happen for that form? or for all form submissions with data

2. make sure your urls are the same, i.e. example.com throughout OR www.example.com not a mixture

if i had to guess, the problem is 2

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 01:59:02 pm
Thanks for the reply :)

To answer your questions:
Quote from: Donald Lobo on February 05, 2010, 11:13:08 am
1. does it only happen for that form? or for all form submissions with data

It only happens for that form. Other forms (create/edit contacts, edit events, etc.) all work fine. Other 'search results tasks' (Map Contacts, Tag Contacts, Record Activities) also work fine.

Quote from: Donald Lobo on February 05, 2010, 11:13:08 am
2. make sure your urls are the same, i.e. example.com throughout OR www.example.com not a mixture
if i had to guess, the problem is 2

I'm not quite sure what you mean here but the URLs are all consistent throughout the site. example.com is redirected to www.example.com through a .htaccess rewrite as is common. The search results page is of the form:
http://www.example.com/civicrm/contact/search/advanced?_qf_Advanced_display=true&qfKey=7e56caf841dc5abb194b1764b8b8548e
and when I select contacts and click through to the 'Add Contacts to Event' participants form (the broken one) it's url is still of the form:
http://www.example.com/civicrm/contact/search/advanced?_qf_Participant_display=true&qfKey=7e56caf841dc5abb194b1764b8b8548e

I don't think this is the problem...

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 02:27:35 pm
Wierdly, after dealing with this for 2 days, I just discovered the cause of the issue.

In my advanced/basic search results, I am using a custom search profile to show different fields (mainly to show a UK counties column as outlined in this thread: http://forum.civicrm.org/index.php/topic,11224.msg48285.html). I don't have a default search set the in the admin->search settings as this is stated as experimental functionality.

When on the advanced search screen and I choose my custom search view from the 'Search views' dropdown in the top right (as my users do by default), I get the search results displayed how I want, but when I choose some and try to add to an event it breaks the participant registration form. When I choose 'default view' from this box, I don't get the columns I want in the results, but I can successfully choose contacts and the 'Add Contacts to events' task works fine. I presume that this is because the search results using my custom profile are not returning the contact IDs somehow, hence the original error of 'Could not find valid cid' from the participants add form. I tried adding contact ID as a field to my search profile but we still get the error.
At least I can get around the issue at the moment, although it would be great if I could get the 'add to event' to work with contact results from my custom search profile.

Not sure if this is a bug or something to do with my setup. Will try to reproduce on the demo site and get back to you. Any one who has any ideas how to make this work with my custom profile would be greatly appreciated.

Cheers

Graham

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 02:53:11 pm
Further to my last message, i have managed to reproduce this error on the 3.1 demo site, so I think it is a bug.

Steps to reproduce:
1) On the menu, select Administer->Customize->CiviCRM profile
2) Create a new profile used for search results, named "Search with Full county" and tick it active
3) Create fields for this profile, all for 'Contacts', with visibility: 'Public Pages' and 'Results column' ticked.
  • field Street address (labelled 'Address Line 1')
  • field City (labelled 'City')
  • field State (labelled 'County')
  • field Country (labelled 'Country')
  • field Email [primary] (labelled 'Email')
  • field Phone [primary][phone] (labelled 'Phone')
4) Go to advanced search, tick 'Individuals' and then under the 'Search views' box in the top right, choose 'Search with Full county' and click search
5) Select some contacts from the search results and choose 'Add Contacts to Event' from the search tasks and click the 'Go' button.
6) See the resulting error!

Should I file this as a bug report?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 05, 2010, 04:14:45 pm

yes

thanx for the detailed steps on reproducing. we'll try to get in a fix before 3.1.2

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Fatal Error: "Could not find valid value for cid" in multiple event registration
February 07, 2010, 08:40:28 am
Bug report filed here:
http://issues.civicrm.org/jira/browse/CRM-5792

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Fatal Error: "Could not find valid value for cid" in multiple event registration

This forum was archived on 2017-11-26.