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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • "could not find valid value for ct" fatal error
Pages: [1]

Author Topic: "could not find valid value for ct" fatal error  (Read 1901 times)

taram

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 2
"could not find valid value for ct" fatal error
March 02, 2009, 01:04:52 pm
Hi, we are getting this error on one of our sites when an existing contact is being edited. After some debugging, I found that every time I get this error the action is 'Add' instead of 'Update' even though I am editing an existing contact. So, it follows the 'add' logic in Edit.php->preprocess and fails with a fatal error at:

$this->_contactType = CRM_Utils_Request::retrieve( 'ct', 'String', $this, true, null, 'REQUEST' );

I am not sure why the action is set to 'add'. Please see the stack trace below:

/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 258
/var/www/xxx/sites/all/modules/civicrm/CRM/Utils/Request.php, fatal, 108
/var/www/xxx/sites/all/modules/civicrm/CRM/Contact/Form/Edit.php, retrieve, 152
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Form.php, preProcess, 300
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, buildForm, 123
/var/www/xxx/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 195
/var/www/xxx/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 95
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 223
/var/www/xxx/sites/all/modules/civicrm/CRM/Utils/Wrapper.php, run, 77
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 561
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Invoke.php, form, 259
/var/www/xxx/sites/all/modules/civicrm/CRM/Core/Invoke.php, contact, 98
/var/www/xxx/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 329
, civicrm_invoke,
/var/www/xxx/includes/menu.inc, call_user_func_array, 418
/var/www/xxx/index.php, menu_execute_active_handler, 15

I have seen multiple forum posts for the same issue but could not find any resolution so far. I appreciate peoples insight into this issue.

Thanks.

apolloblundr

  • Guest
Re: "could not find valid value for ct" fatal error
March 05, 2009, 08:52:29 am
Does this happen for every contact type and every edit link/button or a specific one?

Edit.php->preprocess runs a PHP $_REQUEST on the url and post data and gets the action from that.  For instance, if in the link you have:

[yoursite]/civicrm/contact/add?reset=1&action=add&cid=4282

then the 'add' logic will be followed and preprocess won't find ct in the url (hence your error).

Instead, the url should be: [yoursite]/civicrm/contact/add?reset=1&action=update&cid=4282

Maybe that helps?  I don't seem to have this problem in 2.2.

taram

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 2
Re: "could not find valid value for ct" fatal error
March 05, 2009, 09:48:58 am
Thank you apolloblundr.
It happens with organizations (probably because they are the most edited contacts on our site) and is not consistent. The same org that couldn't be edited can be edited later. You are correct that when the edit fails, the action is set to add (the default action type) and so preprocess can not find ct. After debugging the civi code, we found that the session civi looks at after save button is clicked has the action set to 1 and doesn't have cid.

                CRM_Contact_Form_Edit_2a1465b42118893db4c2f2154aa2c57e_3907     Array [2]       
                        qfKey   (string:37) 2a1465b42118893db4c2f2154aa2c57e_3907       
                        action  (int) 1

Where as when the edit is successful, the session has qfkey, action, cid & uploadnames:

                CRM_Contact_Form_Edit_2a1465b42118893db4c2f2154aa2c57e_6006     Array [4]       
                        qfKey   (string:37) 2a1465b42118893db4c2f2154aa2c57e_6006       
                        action  (int) 2
                        cid     (string:4) 4689
                        uploadNames     null 

It looks like the session is sent correctly to drupal but somehow it doesn't get written to the sessions table and so can not be found by civi.

We also found some javascript errors in the logs and when we cleaned those up, the ct error stopped happening. Jury is still out on whether this will really fix the error on our live site. I will post back once that is confirmed.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: "could not find valid value for ct" fatal error
August 26, 2009, 01:29:28 pm
Taram - did the jury ever deliver a verdict?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

taram

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 2
Re: "could not find valid value for ct" fatal error
September 29, 2009, 01:22:02 pm
peterd, sorry for the delay in my response. We haven't heard any complaints about the ct error after cleaning up javascript errors so, I am guessing that helped. I will update this thread if we hear anything.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • "could not find valid value for ct" fatal error

This forum was archived on 2017-11-26.