No error message

i disabled the clientside validation to the "When" field(Date field) and am using field validation module for this, but when hit the "Register" button i dont get error message only if i hit the "Add another button".

Error message

I tryed this with disabled javascript and the form is working well. Disabled javascript

I had to disable the required option on date field cos of field collection bug. See http://drupal.org/node/1702612 This is why i am using field validation now. THX

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

Your bug report is confusing: you do want to have client side validation for the 'when' field? But the field isn't required in your use case? What needs to be validated, the date format?

mibfire’s picture

Yea it may be confusing. Date field has to be required, but i have to do this with field validation(i am using php validation and when field is empty then error is shown) cos of bug of date field. If i dont do this and set date field required and hit the "add more item" button without filling the date field then there wont be error message saying "When field is required".

Jelle_S’s picture

FileSize
3.01 KB

From what I can tell from you explanation, you are using the "PHP code" validation of Field Validation?
Selection_043.png

If so, Clientside Validation does not support it, and that is why you don't see the error message when submitting the form.
The reason you do get the error message when you click "Add another" is that these messages do not come from Clientside Validation. When you click "Add another", Drupal does an Ajax callback (and bypasses Clientside Validation) and fires the server side validation (PHP). Then it returns the error messages and displays them. So when you click "Add another", Clientside Validation is not fired. It seems to me that this is more a Field Collection issue (as you said: #1702612: field collection doesn't validate multiple value entries) than a Clientside Validation issue, since I don't think it would be possible for us to support the PHP Code validator of Field Validation (or we'd have to do an ajax callback which kind of defeats the purpose of clientside validation).

I'll ask @attiks for his view on this.

mibfire’s picture

I tryed this with builtin "required field" option of field validation but this doesnt work either:( How could i do a workaround for this? FAPI Validation maybe?

Jelle_S’s picture

FileSize
28.13 KB

When I check "Required field" on the edit field page of the "When" field, I get an error message as expected:
Selection_046.png

mibfire’s picture

What did u use? I mean "Field Validation" or "FAPI Validation" module and cutom code or built in function like required option in Field Validation? And i forgot to mention i am using entityform module here.

Jelle_S’s picture

FileSize
17.22 KB

Just standard Drupal, edit the field settings:
Go to Structure -> Field Collections -> Click "Manage fields" next to your field collection (presumably "Trips") -> Click 'edit' next to your date field -> Check the "Required field" checkbox and save.
Selection_047.png

mibfire’s picture

FileSize
37.9 KB

Yes, if i set this, it works me the same way. But i had to disable the clientside validation cos of custom date format as you can see here: http://screencast.com/t/Pb1SSeBBlHIw

If i wanna solve this i should change the date format back to sg similiar like this: 2013 04 05 what i wouldnt like. So how can i keep my date format and set the clientside validation to work?

Jelle_S’s picture

Ah yes, this should be fixed in the latest dev version. Your custom format should work then :-)

mibfire’s picture

So now this hasnt been fixed yet. Should i do a workaround or wait for this?:/

mibfire’s picture

Jelle_S?

Jelle_S’s picture

This has been fixed. If you download the latest dev version from the project page everything should work for you

mibfire’s picture

Thx, great!!!

Jelle_S’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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