conditional validation in Model |
Yes, it is possible to have conditional validation in the Model using the when method in CodeIgniter. You can modify your validation rule for depth as follows:
'depth' => 'required_with[auto_build]|when[auto_build,less_than[4]]' This will ensure that the less_than[4] rule is only applied when the auto_build field is present. You can use the when method to apply any other rules conditionally as well. |
Messages In This Thread |
conditional validation in Model - by sjender - 02-09-2023, 12:51 PM
RE: conditional validation in Model - by sjender - 02-22-2023, 08:19 AM
RE: conditional validation in Model - by digitalarts - 02-28-2023, 09:55 AM
RE: conditional validation in Model - by digitalarts - 03-10-2023, 10:06 AM
RE: conditional validation in Model - by SariyaKarrv - 03-24-2023, 04:08 AM
|