Jet\Form_Field_Password / Form_Field::TYPE_PASSWORD

Represents a form field for hidden password entry.

It uses the Jet\Form_Renderer_Field_Input_Common renderer to display the form field itself.

Default error codes

Code Meaning of
Form_Field::ERROR_CODE_EMPTY The field is marked as required and no value has been entered.
Form_Field::ERROR_CODE_CHECK_NOT_MATCH The check (repeated) entry of the password does not agree with the first entry.
Form_Field::ERROR_CODE_WEAK_PASSWORD Password too weak.
Method Význam
public generateCheckField(
string $field_name,
string $field_label,
string $error_message_empty,
string $error_message_not_match
) : Form_Field_Password
To enter a password, a method can be used where the user enters the password in two fields and checks that they match each other. The generation and function of such a control field is still a repetitive piece of code. For this reason, this form field allows its control "twin" to be generated and set automatically. For example like this: use Jet\Form;
use 
Jet\Form_Field_Password;

// ... ... ...
$password_field = new Form_Field_Password'password''Password:' );
$password_field->setErrorMessages( [
    
Form_Field_Password::ERROR_CODE_EMPTY => 'Please enter password',
] );
$password_check_field $password_field->generateCheckField(
    
field_name'password_check',
    
field_label'Confirm password:',
    
error_message_empty'Please confirm password',
    
error_message_not_match'Password confirmation do not match'
);

$form = new Form'registration_form', [
    
$username_field,
    
$password_field,
    
$password_check_field
] );

// ... ... ...
Previous chapter
Jet\Form_Field_WYSIWYG / Form_Field::TYPE_WYSIWYG
Next chapter
Jet\Form_Field_File / Form_Field::TYPE_FILE