FORMATIVE 5 Flashcards

(17 cards)

1
Q

Which validation rule would you use to check if a data is in correct format?

date_format

correct_date

valid_date

valid_format

A

valid_date

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which validation rule would you use to ensure a field is exactly 10 characters long?
Group of answer choices

length_exact

exact_length

fixed_length

size_10

A

exact_length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you set a custom rule in CodeIgniter 4?
Group of answer choices

Define the rule in the view file

Use the setRule() method or define it in the configuration file

Set the rule in the database

Use the customRule() method

A

Use the setRule() method or define it in the configuration file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which method is used to validate data in CodeIgniter 4?
Group of answer choices

validate()

confirm()

check()

verify()

A

validate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which method is used to retrieve a specific error message for a particular field?
Group of answer choices

retrieveError(‘field’)

showError(‘field’)

getError(‘field’)

fetchError(‘field’)

A

getError(‘field’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which validation rule would you use to ensure a field contains only numeric values?
Group of answer choices

is_integer

is_number

digits_only

numeric

A

numeric

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you ensure a field is not empty and has a value in CodeIgniter 4?
Group of answer choices

non_empty

mandatory

required

filled

A

required

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where can validation rules be defined in CodeIgniter 4?
Group of answer choices

In the view files

In the controller or a validation configuration file

In the database schema

In the app/Views directory

A

In the controller or a validation configuration file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you specify validation rules directly in the model for CodeIgniter 4?
Group of answer choices

$validationRules property

$validateRules property

$modelRules property

$rules property

A

$validationRules property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you combine multiple validation rules for a single field?
Group of answer choices

Use a comma , between rules

Use a plus sign + between rules

Use an ampersand & between rules

Use a pipe | between rules

A

Use a pipe | between rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the withInput() method do when validation fails in CodeIgniter 4?

Displays error messages

Redirects back with the old input
data

Clears the input fields

Saves the input data to the database

A

Redirects back with the old input data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which validation rule checks if a field value exists in a set of values?
Group of answer choices

in_set

allowed_values

exists_in

in_list

A

in_list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you set custom error messages for validation rules in CodeIgniter 4?
Group of answer choices

Pass an associative array of rules and messages to the validate() method

Define them in the view file

Set them in the database

Use the errorMessage() method

A

Pass an associative array of rules and messages to the validate() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you validate if a field matches another field in CodeIgniter 4?
Group of answer choices

matches

compare

match

equal_to

A

matches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which method retrieves the validation error messages in CodeIgniter 4?
Group of answer choices

displayErrors()

showErrors()

getErrors()

getErrorMessages()

A

getErrors()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you apply validation rules to a specific field in a controller?
Group of answer choices

Use $this->applyRules(‘field’, ‘rules’)

Use $this->validation->field(‘rules’)

Use $this->validate([‘field’ => ‘rules’])

Use $this->setRules(‘field’, ‘rules’)

A

Use $this -> validate([‘field’ => ‘rules’])

17
Q

Which built-in validation rule checks if a value is a valid email address?
Group of answer choices

valid_email

email_check

valid_email_address

email_valid