As long as you don't change form elements, you can use traditional javascript/jquery. So it would be OK to hide/show or disable/enable the CVV field in your example. <div><br></div><div>If you change them (for example, by adding in a CVV field, or by changing the options in a select) then form validation will fail. That's the case where you're forced into AJAX(D7)/AHAH.</div>
<div><br></div><div>If you find you need to do AHAH, there are working examples in the Examples module (<a href="http://drupal.org/project/examples">http://drupal.org/project/examples</a>), and there is a tutorial at <a href="http://randyfay.com/ahah">http://randyfay.com/ahah</a>, which also has references to other information.</div>
<div><br></div><div>-Randy </div><div><br><div class="gmail_quote">On Sun, Nov 22, 2009 at 1:37 PM, Jeff Greenberg <span dir="ltr"><<a href="mailto:jeff@ayendesigns.com">jeff@ayendesigns.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Haven't delved into AHAH yet, this might force the issue.<br>
<br>
<br>
Using an easy (=less typing) example. A credit card form. When the credit card type is selected from a select, the selection needs to fire a javascript function that will disable fields that don't apply to that card type (such as CVV).<br>
<br>
<br>
Normally, I would have an onchange event for the select, and noticed that in the form api, while there is an attribute section to add miscellaneous attributes, the doc doesn't mention events as examples. And if putting an event there is legitimate, there isn't a mention of how to include the responding js function in the form.<br>
<br>
<br>
If AHAH is the way I'm supposed to handle this, I'd appreciate being pointed to a good similar example, because I'm a bit unclear from the AHAH entries in the form reference docs, for example, how to relate the myhandler/js entry to a physical location of the function, and how the function gets there.<br>
<br>
<br>
Thanks!<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Development, troubleshooting, and debugging<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>
</div>