Answers.Body: <p>I've created an issue and a PR for this fix. See <a href="https://issues.civicrm.org/jira/browse/CRM-18447" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-18447</a> and <a href="https://github.com/civicrm/civicrm-core/pull/8188" rel="nofollow">https://github.com/civicrm/civicrm-core/pull/8188</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-20T12:04:07.277Z
Answers.LastActivityDate: 2016-04-20T12:04:07.277Z
Answers.UserDisplayName: Ken West
Body: <p>This is an issue with 4.7.6 and its reproducible on the Drupal 7 demo site.</p>
  
  <ol>
  <li>Create a custom field called 'X' for Events that is required</li>
  <li>Attempt to create a Survey via civicrm/survey/add (enter values and press 'Continue')</li>
  </ol>
  
  <p>Step 2 fails with the error 'X is a required field'</p>
  
  <p>The issue can be fixed by changing line 83 of CRM/Campaign/Form/Survey.php ...</p>
  
  <pre><code>$this-&gt;set('type', 'Event');
  </code></pre>
  
  <p>to</p>
  
  <pre><code>$this-&gt;set('type', 'Survey');
  </code></pre>
  
  <p>This change fixes the problem, but I'm unsure whether there is a deeper issue.</p>
  
  <p>The form that is used by civicrm/survey/add is CRM/Campaign/Form/Survey/Main.php. The parent form is CRM/Campaign/Form/Survey.php. The possibly deeper issue is that the preProcess function of both forms (Main.php and Survey.php) deals with Custom Data.</p>
  
  <p>I feel the child form (Main.php) should leave it to its parent to deal with Custom Data. But I think someone from the Core team might need to look at that.</p>
  
Tags: <civicampaign><civisurvey>
Title: Cannot create Survey when Events have 'is required' custom data: is this the fix?
ThreadText: # Cannot create Survey when Events have 'is required' custom data: is this the fix?
  
  (Asked by: username_0 on 2016-04-19)
  
  This is an issue with 4.7.6 and its reproducible on the Drupal 7 demo site.
  
  Create a custom field called 'X' for Events that is required
  Attempt to create a Survey via civicrm/survey/add (enter values and press 'Continue')
  
  Step 2 fails with the error 'X is a required field'
  The issue can be fixed by changing line 83 of CRM/Campaign/Form/Survey.php ...
  $this->set('type', 'Event');
  
  to
  $this->set('type', 'Survey');
  
  This change fixes the problem, but I'm unsure whether there is a deeper issue.
  The form that is used by civicrm/survey/add is CRM/Campaign/Form/Survey/Main.php. The parent form is CRM/Campaign/Form/Survey.php. The possibly deeper issue is that the preProcess function of both forms (Main.php and Survey.php) deals with Custom Data.
  I feel the child form (Main.php) should leave it to its parent to deal with Custom Data. But I think someone from the Core team might need to look at that.
  
  **Tags:** civicampaign, civisurvey
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-04-20. Score: 1
  
  I've created an issue and a PR for this fix. See <https://issues.civicrm.org/jira/browse/CRM-18447> and <https://github.com/civicrm/civicrm-core/pull/8188>
  
  
  ---
  
  