[support] Javascript and CCK fields

Carl Wiedemann carl.wiedemann at gmail.com
Wed Mar 2 23:46:16 UTC 2011


>
> If you don't care that it's on every page, couldn't you just add it to
> the .info file of the theme?


You could, but then the JS is dependent on the theme. Switching the theme or
usage of an admin theme could affect the functionality.

On Wed, Mar 2, 2011 at 2:48 PM, Anthony Malkoun <malkouna at yahoo.com.au>wrote:

> If you don't care that it's on every page, couldn't you just add it to
> the .info file of the theme?
>
> On 6:59 AM, Carl Wiedemann wrote:
> > If you don't care that the JS is added on every page, you might as
> > well put it in hook_init. Otherwise if you want to use the same JS on
> > multiple forms you would need multiple #after_build or #theme
> > callbacks, which is repetitive and a little messy. Write your JS so
> > that if indicative elements aren't present in the DOM it returns early.
> >
> > On Wed, Mar 2, 2011 at 6:53 AM, Joel Willers <joel.willers at sigler.com
> > <mailto:joel.willers at sigler.com>> wrote:
> >
> >     I’m looking to do calculations between CCK fields.  I’ve found
> >     some cool ways to add Javascript to a page, but before I get too
> >     far into this, I figured I’d ask for some quick advice to see if
> >     there was a better way.
> >
> >     Basically, I’m looking to do math on an ‘onchange’ event.  If
> >     Field A is set (base) and Field B is changed, Field C and D
> >     automatically update.  Similarly, if C changes, B and D update,
> >     and same for D changing B and C.  I’m planning to use the
> >     technique described at:
> >
> >
> http://switchbackcms.com/blog/right-way-include-javascript-your-drupal-form
> ,
> >     but at http://drupal.org/node/322290 (#7) there is talk of adding
> >     a theme function, which I’m guessing I could do using a nice
> >     tpl.php file.
> >
> >     Any suggestions are welcome, especially if there is an already
> >     existing module for field relationships.
> >
> >     Joel
> >
> >     **
> >
> >
> >     --
> >     [ Drupal support list | http://lists.drupal.org/ ]
> >
> >
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110302/21af4f46/attachment-0001.html 


More information about the support mailing list