6

I have a pretty complex form with several nested Fieldsets and Collections. Some parts of the form are constant, other parts are variable:

BasicSettings EndpointBasicSource (constant part) EndpointBasicTarget (constant part) SpecificSettings EndpointType{TYPE}Source (variable part) EndpointType{TYPE}Target (variable part)

The EndpointBasicSource and EndpointBasicTarget contain a ServerFieldset, that provides the Field server_name. That means: The form contains at least 2 server_name Fields.

In the SpecificSettings depending on the EndpintType no, one, or both sides can contain a servers Collection (options.target_element.type => ServerFieldset) with up to 5 servers in it.

Here is a strongly simplified schema:

enter image description here

Now the servers should get unique (in all the server_name fields in the form a value may not recur). But how to do this? The problem is, that the ServerFieldset is injected via multiple other Fieldsets/Collections and the uniqueness validation needs to relate to the server_name Fields in all of them.

How can this problem be solved and a uniqueness validation for all the server_name in the entire form implemented?

automatix
  • 14,018
  • 26
  • 105
  • 230
  • 1
    Have you tried using a [Callback validator](https://framework.zend.com/manual/2.1/en/modules/zend.validator.callback.html)? There you can get a specific input $value and the $context, which is an array with all the other inputs. – Edson Horacio Junior Jan 10 '17 at 20:12

0 Answers0