Important piece of uniqueness widget code (javascript and options) is placed inside hook_form_alter but this hook is not invoked when form validation errors arise. Piece of widget code should be moved to after_build functions. I will send the patch, soon

CommentFileSizeAuthor
#1 uniqueness-1316200-1-6x10rc1-D6.patch6.13 KBkndr

Comments

kndr’s picture

Status: Active » Needs review
StatusFileSize
new6.13 KB

Here is the patch. Some pieces of code are moved to after_build functions. There is also additional check to prevent Drupal.settings from being added twice during validation phase.

bforchhammer’s picture

Sorry, I can't reproduce your problem. When I add a required CCK field and force a validation error, I still do get the "related content" widget, prefilled with nodes matching the current title... Could you provide a more detailed description of your problem?

kndr’s picture

Hm. Did you test it inside a block? I use uniqueness widget as a block and it disappears when errors are shown. I didn't test it on pure Drupal installation. I use Panels and I've put widget as a block inside 'node edit/add' page. Widget is connected with Apache Solr. I use Pressflow, too.

kndr’s picture

I've done quick search about problem with javascipt and hook_form_alter. Look, for example, at #908910: JS/CSS files not loading after a validation error. You will see, that problem is resolved by #after_build callback.