View Issue Details
|OXID eShop (all versions)
|1. ----- eShop frontend -----
|4.8.8 / 5.1.8
|Fixed in Version
|0006010: Form validation does not check whether a dynamic form field has any values or not
|If you add "oxuser__oxstateid" to the aMustFillFields for the registration and a country does not have a state you will get an error message.
Validation should only take effect if the selected country has got a state to select.
|Steps To Reproduce
|Go into the OXID admin-> Master Settings-> Core Settings-> Settings -> Other Settings -> Mandatory fields in User Registration Form.
Add "oxuser__oxstateid" right there.
Then go to the registration page and try to register with a country, which does not have a state to select.
|No tags attached.
I changed the subject slightly to clarify to topic. This behavior is not specific to the oxuser__oxstateid field, but applies to any dynamic form field. A dynamic form field is a field which can have different values, depending on the value of another form field.
In this particular case, the values of the oxuser__oxstateid field change depending on the country which was selected (as obviously Germany has other states than the US, for example).
We created a form validation which is as generic as possible, but can be extended for project specific needs. You could write a module which enhances the stock validator by this feature. The place to extend should be this one: http://goo.gl/TbJeAk
From my point of view, this is a feature enhancement: Extend the validator in such a way that it is aware of dynamic fields and validates those fields only if there are any options (=values) to display at all. I will put it on our Product Backlog, and we would be happy to get a contribution for this.
As for now, we should update our documentation and point out that adding a dynamic field to the $aMustFillFields might have side effects, if the dynamic field does not have any values.
|This is definitely a feature, not a bug. Our validators do not support this kind of dynamic field validation. It would be possible to customize the validation in this area when needed, but it would also be nice to extend the existing field validators with this