Body: <p>I am seeing a fatal <code>could not find value for 'ct'</code> error when some of my users try to save a new contact. The associated error log is the following:</p>
  
  
  
  <pre><code> [debug] $backTrace = #0 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Error.php(385): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Utils/Request.php(121): CRM_Core_Error::fatal("Could not find valid value for ct")
  #2 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php(165): CRM_Utils_Request::retrieve("ct", "String", Object(CRM_Contact_Form_Contact), TRUE, NULL, "REQUEST")
  #3 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Form.php(590): CRM_Contact_Form_Contact-&gt;preProcess()
  #4 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(129): CRM_Core_Form-&gt;buildForm()
  #5 /var/www/html/clcnsw/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload-&gt;perform(Object(CRM_Contact_Form_Contact), "upload")
  #6 /var/www/html/clcnsw/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Contact_Form_Contact), "upload")
  #7 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("upload")
  #8 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(114): CRM_Core_Controller-&gt;run()
  #9 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(263): CRM_Utils_Wrapper-&gt;run("CRM_Contact_Form_Contact", "New Contact", (Array:1))
  #10 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #11 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #12 /var/www/html/clcnsw/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  #13 /var/www/html/clcnsw/includes/menu.inc(527): civicrm_invoke("contact", "add")
  #14 /var/www/html/clcnsw/index.php(21): menu_execute_active_handler()
  #15 {main}
  </code></pre>
  
  <p>I think this is just after the permissions check in <code>civicrm/CRM/Contact/Form/Contact.php</code> but beyond that I am not sure what is causing this. </p>
  
  <p>The user is logged in, has appropriate permissions and can go back and try again, generally with success. However, work they were doing at the time is lost, which they are not happy about. </p>
  
  <p>The only other clue I have is that some users have been accessing the system with a shared account - I suggested they not do this but the office admin wants all volunteers to log in with a shared "volunteer account" for data entry. It is usually this user that experiences this issue. Although to be fair they also do most new data entry.</p>
  
  <p>I don't know if that could be causing this problem. If it is I would appreciate a good way to demonstrate this so I can convince my bosses this practice should be stopped. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-19T05:13:18.660Z
Comments.Text: Are they sucessfully saving one contact, then clicking the back button, overwriting with new info thinking they are making a new contact, then clicking save? That's what this sounds like to me.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-19T05:32:00.523Z
Comments.Text: Make sure that the page which loads on the screen for adding a new contact has `ct=Individual` or ct=organization/household in the URL.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-19T06:18:49.823Z
Comments.Text: I haven't been able to reproduce the issue myself. It is happening to people doing data entry and they are sending me screenshots of the problem. It is not occurring on every new contact they create. @jitendra-fuzion are you saying I should check that is the page they are seeing or should I be ensuring that programatically somewhere?
Comments.UserDisplayName: tanbog
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-19T10:58:18.920Z
Comments.Text: I think that the link they're using to create a contact is wrong and should have `ct` in the query string.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-20T03:33:17.400Z
Comments.Text: @jitendra-fuzion and how would I even fix that? As far as I am aware the users are clicking the "save" button to save the new contact. Does that mean there is a problem with how Civicrm is generating the link?
Comments.UserDisplayName: tanbog
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-24T06:04:32.827Z
Comments.Text: @tanbog I suggested a way to reproduce which does reproduce the error for me and which I have seen before. Have you tried that? It might not be what they are doing but is a way to reproduce it.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-25T05:03:06.020Z
Comments.Text: @Demerit what you describe does not cause the error for me. In any case I have watched the people doing data entry and they are not doing that.
Comments.UserDisplayName: tanbog
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-25T05:11:26.633Z
Comments.Text: Ok interesting. I just tried again on the public demo https://dmaster.demo.civicrm.org and I get that error. Maybe it's a clue about something unique about your setup.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-25T05:14:35.717Z
Comments.Text: I try to stay pretty close to what the documentation recommends. If we've done something wrong I'd love top track it down but I have no idea where to start. What's worked so far is forcing the users on to separate accounts. Though I suspect people will slip in to account sharing again unless I can explain why that is the problem.
Comments.UserDisplayName: tanbog
Tags: <contacts><error><forms>
Title: Could not find value for CT fatal error
ThreadText: # Could not find value for CT fatal error
  
  (Asked by: username_0 on 2019-11-19)
  
  I am seeing a fatal `could not find value for 'ct'` error when some of my users try to save a new contact. The associated error log is the following:
  
  ```
   [debug] $backTrace = #0 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Error.php(385): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Utils/Request.php(121): CRM_Core_Error::fatal("Could not find valid value for ct")
  #2 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php(165): CRM_Utils_Request::retrieve("ct", "String", Object(CRM_Contact_Form_Contact), TRUE, NULL, "REQUEST")
  #3 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Form.php(590): CRM_Contact_Form_Contact->preProcess()
  #4 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(129): CRM_Core_Form->buildForm()
  #5 /var/www/html/clcnsw/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contact_Form_Contact), "upload")
  #6 /var/www/html/clcnsw/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Contact), "upload")
  #7 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("upload")
  #8 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(114): CRM_Core_Controller->run()
  #9 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(263): CRM_Utils_Wrapper->run("CRM_Contact_Form_Contact", "New Contact", (Array:1))
  #10 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #11 /var/www/html/clcnsw/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #12 /var/www/html/clcnsw/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  #13 /var/www/html/clcnsw/includes/menu.inc(527): civicrm_invoke("contact", "add")
  #14 /var/www/html/clcnsw/index.php(21): menu_execute_active_handler()
  #15 {main}
  
  ```
  
  I think this is just after the permissions check in `civicrm/CRM/Contact/Form/Contact.php` but beyond that I am not sure what is causing this.
  
  The user is logged in, has appropriate permissions and can go back and try again, generally with success. However, work they were doing at the time is lost, which they are not happy about.
  
  The only other clue I have is that some users have been accessing the system with a shared account - I suggested they not do this but the office admin wants all volunteers to log in with a shared "volunteer account" for data entry. It is usually this user that experiences this issue. Although to be fair they also do most new data entry.
  
  I don't know if that could be causing this problem. If it is I would appreciate a good way to demonstrate this so I can convince my bosses this practice should be stopped.
  
  **Tags:** contacts, error, forms
  
  > **Comments:**
  > **username_1**: Are they sucessfully saving one contact, then clicking the back button, overwriting with new info thinking they are making a new contact, then clicking save? That's what this sounds like to me.  
  > **username_2**: Make sure that the page which loads on the screen for adding a new contact has `ct=Individual` or ct=organization/household in the URL.  
  > **username_0**: I haven't been able to reproduce the issue myself. It is happening to people doing data entry and they are sending me screenshots of the problem. It is not occurring on every new contact they create. @username_2 are you saying I should check that is the page they are seeing or should I be ensuring that programatically somewhere?  
  > **username_2**: I think that the link they're using to create a contact is wrong and should have `ct` in the query string.  
  > **username_0**: @username_2 and how would I even fix that? As far as I am aware the users are clicking the "save" button to save the new contact. Does that mean there is a problem with how Civicrm is generating the link?  
  > **username_1**: @username_0 I suggested a way to reproduce which does reproduce the error for me and which I have seen before. Have you tried that? It might not be what they are doing but is a way to reproduce it.  
  > **username_0**: @username_1 what you describe does not cause the error for me. In any case I have watched the people doing data entry and they are not doing that.  
  > **username_1**: Ok interesting. I just tried again on the public demo https://dmaster.demo.civicrm.org and I get that error. Maybe it's a clue about something unique about your setup.  
  > **username_0**: I try to stay pretty close to what the documentation recommends. If we've done something wrong I'd love top track it down but I have no idea where to start. What's worked so far is forcing the users on to separate accounts. Though I suspect people will slip in to account sharing again unless I can explain why that is the problem.  
  
  ---
  
  ## 0 answers
  
  