Skip to main content

Articles tagged with "jquery"

Show elements with form #states when values do not match

17th Jan 2017

I've previously written about dynamic forms in Drupal, using #states to show or hide input boxes depending on other inputs. Since then, Drupal 7 and 8 have both got the ability to combine conditions with OR and XOR operators. This makes it possible to apply changes when a form element's value does not equal something, which is not obvious at all.

Read more

Multiple conditions for dynamic forms in Drupal 7

5th Jul 2011

Here's a quick follow-up to my original post on Dynamic forms in Drupal 7, as a reply to Wappie08, who asked me about combining conditions in the #states array to add increased control over the display of your form elements.

The question:

Hi James Williams, I read your blog post about d7 & #states in the FAPI which is really cool! One problem is that the information is also listed in the example module, I was missing one important extra hint: how can you make an IF statement?

I mean:
IF field_1 is '1' or...

Read more

Quick Guide to using drupal_add_tabledrag and enjoying jquery drag and drop loveliness

6th Mar 2009

We are finding that the feature exciting most end users in Drupal 6 is the lovely new jquery based drag and drop, as seen on the blocks and menu edit pages - we will be quite happy never have to explain the concept of "weights" again. The best news is that you can add this functionality to your own forms for free - and here is how.

Build and theme the form

We are assuming your vaguely familiar with the form API - you can brush up here - so we won't go into too much detail here....

Read more