Configuring Forms

You can change the default form error messages in the configuration.

forms:
	messages:
		EQUAL: 'Please enter %s.'
		NOT_EQUAL: 'This value should not be %s.'
		FILLED: 'This field is required.'
		BLANK: 'This field should be blank.'
		MIN_LENGTH: 'Please enter at least %d characters.'
		MAX_LENGTH: 'Please enter no more than %d characters.'
		LENGTH: 'Please enter a value between %d and %d characters long.'
		EMAIL: 'Please enter a valid email address.'
		URL: 'Please enter a valid URL.'
		INTEGER: 'Please enter a valid integer.'
		FLOAT: 'Please enter a valid number.'
		MIN: 'Please enter a value greater than or equal to %d.'
		MAX: 'Please enter a value less than or equal to %d.'
		RANGE: 'Please enter a value between %d and %d.'
		MAX_FILE_SIZE: 'The size of the uploaded file can be up to %d bytes.'
		MAX_POST_SIZE: 'The uploaded data exceeds the limit of %d bytes.'
		MIME_TYPE: 'The uploaded file is not in the expected format.'
		IMAGE: 'The uploaded file must be image in format JPEG, GIF, PNG or WebP.'
		Nette\Forms\Controls\SelectBox::VALID: 'Please select a valid option.'
		Nette\Forms\Controls\UploadControl::VALID: 'An error occurred during file upload.'
		Nette\Forms\Controls\CsrfProtection::PROTECTION: 'Your session has expired. Please return to the home page and try again.'

If you are not using the whole framework and therefore not even the configuration files, you can change the default error messages directly in the Nette\Forms\Validator::$messages field.

version: 4.0 3.x 2.x