Hi all, I've just upgrade this module from 7.x-1.35+3-dev to 7.x-1.37+7-dev and the following issues have happened:

  1. All my error messages from "FIELD-NAME is a required field" became "This field is required"
  2. All my error message translations in ITA language have disappeared (ENG is shown instead)

Why?

How can I restore the situation?

Thank you very much for helping me

Comments

Jelle_S’s picture

My mistake, I noticed it, fixed it, but forgot to commit it apparently :s

Committed to latest dev, thanks for the report!

Jelle_S’s picture

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jramby’s picture

Status:Closed (fixed)» Active

I've installed the latest dev "7.x-1.37+18-dev" the problem is always there... it disappears after a cache clear but comes back after some error messages shown...

Thank you very much.

attiks’s picture

#4 on the same field? with the same user? Can you provide more details so we can reproduce this?

jramby’s picture

Yes, on the same pages and fields, with the same user, and the same forms... I don't know exactly when does "This field is required" error message comes back but after several page reloadings and several blur actions...

Thank you for answering.

jramby’s picture

Can anybody reproduce this error, or am I the only one still getting this error ?

jramby’s picture

I'm watching to this right now in my site, ... And I noticed that i forgot to mention that I'm showing my forms in a colorbox overlay... I enable it as a block and showing it with colorbox providing a full node view to its block...

After closing the form (colorbox) I can't get the right error message anymore... so I think, the problem is related to this... can anybody explain... or see what's wrong in what I've done?

Thanks,

Jramby

attiks’s picture

do you have the same problem without the colorbox?

jramby’s picture

Without colorbox there is no closing action.. so, I don't know how to check without colorbox... I think the error can't be shown without the close action.

Thanks for your time.

jramby’s picture

I found a quick and maybe dirty solution... please tell me if there is something that might be broken after this change...

diff --git a/sites/all/modules/clientside_validation/clientside_validation.js b/sites/all/modules/clientside_validation/clientside_validation.js
index 8327e2b..7ba1b08 100644
--- a/sites/all/modules/clientside_validation/clientside_validation.js
+++ b/sites/all/modules/clientside_validation/clientside_validation.js
@@ -799,7 +799,7 @@
             self.validators[formid].settings.messages[elem.name] = {};
           }
           $.extend(self.validators[formid].settings.messages[elem.name], rule.messages);
-          delete rule.messages;
+          //delete rule.messages;
           $elem.rules("add",rule);
           $elem.change(hideErrordiv);
         }

I've commented out the line delete rule.messages and then my messages didn't came back to "This field is required" anymore...

Wish it would be the solution.

Thanks.

jramby’s picture

I see my mistake.... by deleting this the whole clientside validation of the whole form on submit is broken... :( what should I do to make the two works... even just for a quick solution.

Again, thanks

attiks’s picture

#12 I understand your problem, but we need to first figure out if the problem is related to colorbox or not.

Where is your form coming from: webform, custom, other?
How is the form loaded into colorbox?
Why can't you test it without colorbox?

jramby’s picture

The form is "coming from" webform.

I enable it as a block and showing it with colorbox providing a full node view to its block

I'm using the colorbox-inline class to call the webform block to be shown as a lightbox.

I can test it without colorbox, but the problem is shown when I'm closing the colorbox lightbox.

When I load webform forms on colorbox for the first time, it is showing correctly with the right validation error messages (they are shown greatly in french with the right label).

When I close the colorbox and reopen this same or any other webform forms on colorbox, errors are shown in English and field label are missing.

I'm using Webform 7.x-4.0-alpha6+1-dev, Clientside Validation 7.x-1.37+18-dev.

Thanks.

attiks’s picture

So the problem is caused by the use of colorbox, do you get any errors (js) the second time?

jramby’s picture

No, I don't get any error at any time... (js or not js)... no error.

attiks’s picture

Do you get the error after submitting the form as well, or only after closing? Or does the submit a redirect?

jramby’s picture

After submit, there is a page loading (redirect or load another page... or even reloads the same page... ), though, after load the validation error messages are allright again.

After closing colorbox there is no page loading... just errors becoming broken...

attiks’s picture

I don't hqve time to debug this now, but you can try looking at what is happening after colorbox is closed, are al drupal.settings still the same, is the behaviour of clientside validation called, ....

alexey.gorb’s picture

Issue summary:View changes
Status:Active» Needs review
StatusFileSize
new3.54 KB

Guys, I've done some investigation and found that there are multiple sources of this issue.

  1. First, via colorbox and ajax requests Drupal.ajax does not receive any new settings for clientsideValidation, since in hook_js_alter() the modification to $javascript array is done, so it is resolved by switching back to drupal_add_js(). Probably you will need to do an ajax request to fetch the correct settings for the form in case you want to make your colorbox work, but I was dealing with the plain ajax form on a page.
  2. Second, the JS in Drupal.clientsideValidation.prototype.bindRules deletes "messages" property from settings, so even though the correct settings were received, the messages are dropped, this is why it falls back to default error messages. So I've changed code to make copies of objects prior to deleting something. BTW, commenting out the "delete" line doesn't help since jQuery.validate does not accept the object like that and throws a JS exception.

So, I'm attaching a patch with the described changes so you can review and test =)

  • Jelle_S committed f9bc769 on 7.x-1.x authored by alexey.gorb
    Issue #1896426 by alexey.gorb | MXT: Fixed "FIELD-NAME is a required...
Jelle_S’s picture

Status:Needs review» Fixed

Fixed in latest dev version. Thanks for the patch!

  • Jelle_S committed 12d3c5a on 7.x-2.x
    Issue #1896426 by MXT: Fixed 'FIELD-NAME is a required field' became '...
  • Jelle_S committed f9bc769 on 7.x-2.x authored by alexey.gorb
    Issue #1896426 by alexey.gorb | MXT: Fixed "FIELD-NAME is a required...

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.