Is there a way to simplify this assignmet in Velocity?
#if($errors.contains("Field required.")
#set($requiredFieldErrors = true)
#else
#set($requiredFieldErrors = false)
#end
So I need the $requiredFieldErrors as boolean so I can use the value later on in a if-else statement. A definition in one line would be great.
You can modify this to:
Or directly test it in the if statement (assuming you’re not using the $reqField reference in other places).
Edit:
The above line will check to make sure $errors is a valid reference and contains the required value.