<meta charset="utf-8"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
If you don't care that it's on every page, couldn't you just add it to<br>the .info file of the theme?</blockquote><div><br></div><div>You could, but then the JS is dependent on the theme. Switching the theme or usage of an admin theme could affect the functionality.</div>
<br><div class="gmail_quote">On Wed, Mar 2, 2011 at 2:48 PM, Anthony Malkoun <span dir="ltr"><<a href="mailto:malkouna@yahoo.com.au">malkouna@yahoo.com.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If you don't care that it's on every page, couldn't you just add it to<br>
the .info file of the theme?<br>
<div class="im"><br>
On 6:59 AM, Carl Wiedemann wrote:<br>
> If you don't care that the JS is added on every page, you might as<br>
> well put it in hook_init. Otherwise if you want to use the same JS on<br>
> multiple forms you would need multiple #after_build or #theme<br>
> callbacks, which is repetitive and a little messy. Write your JS so<br>
> that if indicative elements aren't present in the DOM it returns early.<br>
><br>
> On Wed, Mar 2, 2011 at 6:53 AM, Joel Willers <<a href="mailto:joel.willers@sigler.com">joel.willers@sigler.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:joel.willers@sigler.com">joel.willers@sigler.com</a>>> wrote:<br>
><br>
> I’m looking to do calculations between CCK fields. I’ve found<br>
> some cool ways to add Javascript to a page, but before I get too<br>
> far into this, I figured I’d ask for some quick advice to see if<br>
> there was a better way.<br>
><br>
> Basically, I’m looking to do math on an ‘onchange’ event. If<br>
> Field A is set (base) and Field B is changed, Field C and D<br>
> automatically update. Similarly, if C changes, B and D update,<br>
> and same for D changing B and C. I’m planning to use the<br>
> technique described at:<br>
><br>
> <a href="http://switchbackcms.com/blog/right-way-include-javascript-your-drupal-form" target="_blank">http://switchbackcms.com/blog/right-way-include-javascript-your-drupal-form</a>,<br>
> but at <a href="http://drupal.org/node/322290" target="_blank">http://drupal.org/node/322290</a> (#7) there is talk of adding<br>
> a theme function, which I’m guessing I could do using a nice<br>
> tpl.php file.<br>
><br>
> Any suggestions are welcome, especially if there is an already<br>
> existing module for field relationships.<br>
><br>
> Joel<br>
><br>
> **<br>
><br>
><br>
> --<br>
> [ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
><br>
><br>
</div>--<br>
<div><div></div><div class="h5">[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</div></div></blockquote></div><br>