Is it possible to make a client-side validation of fields included in a field collection?

Comments

attiks’s picture

Did you try it?

akamaus’s picture

Component: Code » Documentation

Yes, I enabled clientside_validation_field_validation. It helped for regular fields, but didn't work for fields inside field collections. After your question I decided to double check it and enabled clientside_validation_form. Surprisingly for me, it worked!

I guess the documentation should reflect this.

attiks’s picture

Assigned: Unassigned » attiks
Issue tags: +Needs documentation
jelle_s’s picture

Status: Active » Fixed

Fixed in latest dev by adding a dependency to clientside_validation_form

Status: Fixed » Closed (fixed)

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

dimitrov.adrian’s picture

Version: 7.x-1.33 » 7.x-1.x-dev
Component: Documentation » User interface
Category: support » bug
Status: Closed (fixed) » Needs work
StatusFileSize
new84.94 KB

Not fixed in latest version.

Problem occurs when we have field collection with required fields but the collection is not required by itself.

screenshot

attiks’s picture

"Problem occurs when we have field collection with required fields but the collection is not required by itself" so what has to happen then, do we need to check the fields or not?

dimitrov.adrian’s picture

There is two cases IMHO

1) and easy is just to skip them, because if we get the collection as single field it is not required itself.

2) which seems to be more complicated but more reliable is, to check if there is something filled in the collection, if there is something, then to validate the collection, in case it is "empty", skipping it.

jmuzz’s picture

Issue summary: View changes

I think "2)" is the only correct way to handle it. The fields should all be checked and validated if there is any data entered in any of them. If the field collection item is completely empty and not required then don't validate it.

  • Jelle_S committed 4bd9c43 on 7.x-2.x
    Issue #1665318 by akamaus: Validation of fields inside a field...