I have a website, where I have been trying to build a form with server side and client side validitations of the input fields. More or less I have been achieving progress. Then I put my code from my testing enviroment to the drupal based website, to see how many tweaks do I need to make. Needless to stay lot of things fell apart. Most important at the moment is that my javascript checks if the input field has the correct information, if it does, it colors the input field and changes the helper thex accordingly. This got fully broken on the site. I read a lot and I assumed this may be cause drupal uses an older JQuery that which I was testing with. So with a little help in another question here I invoked the noConcflict and I used the newer jquery with my code. Sadly this did not fix my problem.

The html of the site is located here: http://www.htconsulting.hu/test/form The javascript: http://www.htconsulting.hu/form/validation.js

Ps.: After the noconflict, my popup Jquery UI broke as well, so I hope to find a possible solution outside using noConflict, or solving the popup window now...

3 Answers 3


You should use the jQuery provided by Drupal and try to work with what Drupal provides (JavaScript, Form API, Theme system, etc.) instead of trying to work without it or, worse, against it. The jQuery update module allow you to use updated jQuery releases in Drupal. That would be 1.6.2 for Drupal 7 and 1.3.2 for Drupal 6. Drupal 7 also provides jQuery UI while for Drupal 6, the jQuery UI module should be used to provide it. This way you can avoid compatibility issues between different version of the same library, unnecessary workarounds and fixes over fixes.

Also, you shouldn't use $(document).ready() in Drupal, but add your function to Drupal.behaviors as explained in the Drupal JavaScript API guide (also available for Drupal 6). And off course, for the form generation, validation and submission server-side code, you should use the Form API.

Keep in mind that your are trying to add a form to a Drupal site, not to a stand alone simple PHP script that doesn't already provides all the (server-side) API your need.


The problem appears to be that when you load jquery the first time, you call no-conflict and assign it to $jq. You then load jquery again, re-assigning $ to this 2nd jquery (same version by the way) and after that you load jquery ui. This means that jquery ui is going to attach to the most recently loaded jquery (the one still using $ and not $jq). So $("#dialog").dialog() should work, but $jq("#dialog").dialog() will not, because $jq does not have ui, $ does.

From looking at this page, there is no need for noConflict at all, since both versions of jquery you are loading are 1.6.2.

  • I "fixed" that part, the noConflict was not used because of that. noConflict was invoked, since a few lines above the implemented code, the Drupal system loads a different jquery script: <script type="text/javascript" src="/sites/default/files/js/js_6d5483ff6bf73fe2a0fcd3fb5f1a60c2.js"></script> Now my popup button does work. But the validation all of it, is now non-functional as of last check..
    – Gergely Csata
    Aug 2, 2011 at 18:00

Shameless pug, we created a module todo this, see http://atix.be/docv, the only thing we don't support for the moment is to display the errors in a popup, but feel free to open an issue

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.