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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How to default an Activity type in New Activity form
Pages: [1]

Author Topic: How to default an Activity type in New Activity form  (Read 886 times)

athemiya

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: MySQL client version: mysqlnd 5.0.5-dev - 081106 - $Revision: 28
  • PHP version: Apache/2.2.2 (Win32) PHP/5.3.1
How to default an Activity type in New Activity form
March 31, 2011, 03:16:16 am
Hi all!

Nice to be part of the forums and community. Have been using CiviCRM for a few months now and I'm now getting the tricky parts of customisation I would love help on.

In creating a New Activity -at the top we get "Activity Types". I have managed to customise the system to get rid of the default meeting, phone calls etc and created a new custom field: 'Volunteer Opportunity'.

How can I tell the system to automatically default to Volunteer Opportunity as soon as a user clicks on New Activity and ensure that the relevant custom fields appear?

I have looked in the activity.tpl templates and also the source code and can't see where I would do this?

Help much appreciated :)

Regards,
Athemiya

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to default an Activity type in New Activity form
March 31, 2011, 03:22:38 am
If you have already modified the template, the easiest is probably to add a bit of jquery to change it.

(not tested code:)

{literal}
<script>
jQuery(function($) {
  $("#activity_type_id").val(42);
});
</script>
{/literal}
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

athemiya

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: MySQL client version: mysqlnd 5.0.5-dev - 081106 - $Revision: 28
  • PHP version: Apache/2.2.2 (Win32) PHP/5.3.1
Re: How to default an Activity type in New Activity form
March 31, 2011, 03:27:45 am
Hi Xavier,

Thanks for the rapid response.

Would I inject this into Activity.tpl?
So it would be:
Code: [Select]
{literal}
<script>
jQuery(function($) {
  $("#activity_type_id").val(558);
});
</script>
{/literal}

Where 558 is the ID of my field: Volunteer Opportunity?

Regards,
Athemiya
« Last Edit: March 31, 2011, 03:42:18 am by athemiya »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How to default an Activity type in New Activity form

This forum was archived on 2017-11-26.