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 (Moderator: Dave Greenberg) »
  • JavaScript not interpreted in extraTodo.tpl
Pages: [1]

Author Topic: JavaScript not interpreted in extraTodo.tpl  (Read 359 times)

MonsterFab

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: drupal 7
  • MySQL version: 5.5.4
  • PHP version: 5
JavaScript not interpreted in extraTodo.tpl
November 17, 2014, 05:39:03 am
Hello,

this function is used to modify label of 2 different fields and the values of one of them.
It was working in previous version of CiVi but not seems to be the case with the new version.
I presume the problem comes from the call to jscript procedure but can't fix it.
Lines are :
<script>
cj(function($) {
  $(".crm-activity-form-block-subject .label").html("Title");
  $(".crm-activity-form-block-target_contact_id .label").html("For");
  $(".crm-activity-form-block-target_contact_id .view-value").html($("#with_todo").html());
});
</script>

fields names are ok and the "with_todo" values are generated in the same template
Lines are in the resulting html page but there are no modification of the labels of values.

thanks in advance.

Fab.
« Last Edit: November 17, 2014, 05:43:36 am by MonsterFab »

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: JavaScript not interpreted in extraTodo.tpl
November 17, 2014, 10:41:02 am
I'm not quite sure javascript is the best approach for setting form defaults. Wouldn't it be more efficient to use a buildForm hook?

For debugging your js, have you tried adding something like alert('hello'); to make sure the script is being loaded?
Try asking your question on the new CiviCRM help site.

MonsterFab

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: drupal 7
  • MySQL version: 5.5.4
  • PHP version: 5
Re: JavaScript not interpreted in extraTodo.tpl
November 18, 2014, 12:46:50 am
Hello,

thank you for you answer.

Yes I tested the js functionality by adding a simple alert instead of those problematic lines and it works.
By the way I have other script on the page which are well interpreted but when I follow the same pattern for those lines it doesn't work.

Yours,

Fab.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: JavaScript not interpreted in extraTodo.tpl
November 18, 2014, 04:30:39 am
You must therefore debug your code. Try checking if  $(".crm-activity-form-block-subject .label") has any properties, or a has a length etc.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • JavaScript not interpreted in extraTodo.tpl

This forum was archived on 2017-11-26.