0

I have got a form with quite a lot of checkboxes (can go up to the 100's) in a table and I would like to detect if a checkbox has been clicked by the user. If they have, I would like to automatically display a warning in the form informing the user that they need to save the form if they want the changes to take effect. Similar to how the draggable tables in Drupal work. Anytime, a form element changes, then, show a warning.

My question is, will using jQuery to attach a change event on each checkbox take a major performance-hit? Is there a faster Drupal way to do it? Will using the Drupal way, make performance faster?

1 Answer 1

2

Will using jQuery to attach a change event on each checkbox take a major performance-hit?

Probably, but it depends on the client's configuration. I have a form with around 3 hundred of controls, half of them hidden, some of them auto-copying content using jQuery, and sometimes FireFox has it's problems with it.

Is there a faster Drupal way to do it?

Nope, Drupal way is to use Behaviors, or states, and Behaviors & states thou shalt use... but they are merely Drupal's way to initiate jQuery-based code.

Will using the Drupal way, make performance faster?

Nope, as Drupal way is basically jQuery way too. But it will merely allow you to be reasonably sure that other modules will not interfere with your code (without any significant slowdown).

1
  • Hehhe, got it. Will use behaviors and states. Thanks.
    – SN_26
    Commented Nov 29, 2013 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.