File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2058,6 +2058,7 @@ The following rules can be used alongside the
2058
2058
`default validation rules <https://docs.aplus-framework.com/guides/libraries/validation/index.html#available-rules >`_:
2059
2059
2060
2060
- `exist `_
2061
+ - `existMany `_
2061
2062
- `unique `_
2062
2063
2063
2064
exist
@@ -2077,6 +2078,40 @@ a dot. If the column is not defined, the field name will be used as the column n
2077
2078
2078
2079
``$connection `` is the name of the database connection. The default is ``default ``.
2079
2080
2081
+ existMany
2082
+ #########
2083
+
2084
+ Requires that many values exists in the database.
2085
+
2086
+ .. code-block :: php
2087
+
2088
+ existMany:$tableColumn
2089
+ existMany:$tableColumn,$connection
2090
+
2091
+ This rule is similar to `exist `_. Except it is able to check if many values are
2092
+ present in a database table.
2093
+
2094
+ It can validate many values from a ``select `` HTML element:
2095
+
2096
+ .. code-block :: html
2097
+
2098
+ <select name =" fruits[]" multiple >
2099
+ <option value =" 1" >Apple</option >
2100
+ <option value =" 2" >Orange</option >
2101
+ <option value =" 3" >Pear</option >
2102
+ <option value =" 5" >Banana</option >
2103
+ <option value =" 9" >Strawberry</option >
2104
+ </select >
2105
+
2106
+ The following example will validate if the ids sent in the ``fruits `` field are
2107
+ present in the ``Fruits `` table:
2108
+
2109
+ .. code-block ::
2110
+
2111
+ existMany:Fruits.id
2112
+
2113
+ If any value does not exist, validation will fail.
2114
+
2080
2115
unique
2081
2116
######
2082
2117
You can’t perform that action at this time.
0 commit comments