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) »
  • $form->add javascript
Pages: [1]

Author Topic: $form->add javascript  (Read 1974 times)

reekingofrandomness

  • Guest
$form->add javascript
July 13, 2009, 11:32:40 am
how do you add a javascript function to a form element using the $form->add thing. Whats the correct syntax?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: $form->add javascript
July 13, 2009, 03:20:07 pm

If you are familiar with jQuery, you should do this in the template rather than the php code. is much easier and cleaner

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

reekingofrandomness

  • Guest
Re: $form->add javascript
July 13, 2009, 05:50:53 pm
Thanks. Don't really know what jQuery is. This is all about that priceSet extension and I want it to automatically check that the number put in is less than the stock and if its not reduce it to the number to the number of tickets that are left. I've written a little js function to do that, but need to get it to work with each input for the price set.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: $form->add javascript
July 27, 2009, 01:14:14 am
Try reading this

http://wiki.civicrm.org/confluence/display/CRMDOC21/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens

It's about editing tpl files
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • $form->add javascript

This forum was archived on 2017-11-26.