Part 3 - Client side Validation and feedback Flashcards

(130 cards)

1
Q

this javascript event occurs when an element gets focus

for example the user uses the Tab key to ‘tab’ to an input or clicks on a text input or its label.

A

describe the javascript event
focus

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

describe the following <input /> type and write its syntax

text

A

Allows us to collect a short amount of text from the user such as their name.

Syntax:

<input type=”text” />

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

1.Detect that the user has changed an input value through typing or clicking by responding to form events.
2.In JavaScript, obtain a reference to the input element and its value.
3.Compare that value against what is permitted for that input element and the business requirements of the application.
4.If the value matches the requirements, provide feedback to the user to confirm this.
5.If the value doesn’t match the requirements, provide a different message, indicating that the data is not suitable, and explaining what is needed.
6.If the user attempts to submit the form to the web server while some input values don’t match the requirements, the submission is blocked and a further message explaining what needs to be done is added.
7.If the user attempts to submit the form when all input values match the requirements, then the form submission is permitted.

A

describe 7 steps for user input validation

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

what is the syntax and parameters for the HTML label tag

A

syntax:

<label for="element_id">label text</label>

@param element_id the id of the element the label will be bound to

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

describe the following form element and its syntax

select

A

This is a form element that will create a drop down list of options of which we can select only one option from.

NOTE: However this can be extended to accept multiple selections if the multiple attribute is used

Syntax:

<select name=”” id=””>
    <option value=””>””</option>
    <option value=””>””</option>
    <option value=””>””</option>
</select>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

this will tie a regular expression to the start or end of the value

NOTE: These are placed within the forward slashes with the pattern

A

describe the
javascript regex anchor

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

this javascript event occurs when the value of an element changes at the point the change is completed

for example by clicking or by losing focus after entering text. This event is particularly useful for detecting that the user has made a new selection from a dropdown list, set of radio buttons or checkboxes.

A

describe the javascript event
change

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

This is a form element that can be used to collect a large piece of text from the user such as a comment or review

Syntax:

<textarea></textarea>

A

describe the form element and syntax of

textarea

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

method:
Returns the string value of the regular expression

A

describe the regex method
toString()

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

describe the following <input /> type and write its syntax

hidden

A

Allows us to create a hiddn field that will be sent to the server and hold some value we give it

Syntax:

<input type=”hidden” />

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

what are the three methods to
attach an event handler to a document event

A

this can be done by:
1. attaching the event hanler within the HTML
2. attaching it using javascript (via referencing the element)
3. attach In javascript using the addEventListener() method

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

regex:

/09$/

A

write a regex that will match values that end with 09

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

this is a form element that provides the textual description for the input tag. such as asking a question that will accompany the input

note: this is used in contrast to only using <p> tags

A

describe the HTML form element

<label></label>

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

describe the following attribute of the <input /> tag

Min=””

A

This <input /> attribute

specify a minimum value

NOTE: works only with number, range, date, datetime-local, month, time and week

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

This works just like the text input type but will hide the typed text

Syntax:

<input type=”password” />

A

describe the following <input /> type and write its syntax

password

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

using CSS write the syntax to select an input element which has the type attribute of text

A

syntax:

input[type=text] {
    declaration;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

syntax:

<form onsubmit="script">

@param script the script to be ran on submit

A

what is the syntax and parameters of the <form></form> attribute
onsubmit

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

give 2 attributes of the form element

<textarea></textarea>

A

attributes include:

Rows = “” - the number of rows the textbox will have (in characters)
Cols = “” - the number of columns the textbox will have (in characters)

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

what is the syntax for creating a regex object in javascript

A

syntax:

/pattern/modifier(s);

Example:

var regex = /fox/i;

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

this is a special string of characters that will create a search pattern. it can then be tested against a string to check whether the pattern is contained within the string

A

what is a
regular expression (REGEX)

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

this <input /> attribute gives the input element a name
NOTE: this attribute is sent to the server on form submission

A

describe the following attribute of the <input /> tag

Name = “”

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

this can be accomplished using the HTML

<form></form>

A

how can we collect and then send user input back to a server

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

this is an object that holds the html element that triggered the event and all of its properties

A

describe
event.target

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

is a property of the event.target object and will return the value that is held by the HTML element

A

describe
event.target.value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
describe the following `` type and write its syntax **checkbox**
Similar to the radio input type but when each input shares the same name it becomes a group and the user can select multiple items from the checkbox group Syntax: ``
26
this Is a form element that can be placed within a form and can be used to collect different types of data from the user NOTE: This is a self closing element or empty element so for it to be xml compliant it must be manually closed
describe the HTML form element ``
27
describe the following CSS selector and its syntax **focus**
is a CSS selector that is used to select the element that has focus. syntax: ``` :focus { css declarations; } ```
28
Syntax: `` @param element a html element such as input @param eventType an event type such as onchange @param myScript a javascript function that has 1 argument passed to it being the event object
what is the syntax and parameters that will **attach an event handler to an element via HTML**
29
what is a **regular expression (REGEX)**
this is a special string of characters that will create a search pattern. it can then be tested against a string to check whether the pattern is contained within the string
30
write the regex that will match only the value "fox"
regex: `/^fox$/`
31
describe the following attribute of the `` tag **Required **
This `` attribute states that it is a requirement that this input is filled before form is sent
32
attributes include: Rows = “” - the number of rows the textbox will have (in characters) Cols = “” - the number of columns the textbox will have (in characters)
give 2 attributes of the form element ``
33
describe an **event handler**
this is a script or function that will be able to handle any events that occur on the page
34
write out the HTML that is a skeleton of a form with one input
HTML: ```

```
35
HTML: ```

```
write out the HTML that is a skeleton of a form with one input
36
this can be done by: 1. selecting a form element 2. selecting a form element and attribute 3. selecting the class of an element 4. selecting the id of an element
name 4 ways we can select elements and style forms in CSS
37
This `` attribute specify a maximum value NOTE: works only with number, range, date, datetime-local, month, time and week
describe the following attribute of the `` tag **Max=”” **
38
HTML: ```
label text` @param element_id the id of the element the label will be bound to
what is the syntax and parameters for the HTML label tag
45
name 3 javascript regex methods
methods: 1. exec() 2. test() 3. toString()
46
describe the javascript event **change**
this javascript event occurs when the value of an element changes at the point the change is completed for example by clicking or by losing focus after entering text. This event is particularly useful for detecting that the user has made a new selection from a dropdown list, set of radio buttons or checkboxes.
47
name 4 ways we can select elements and style forms in CSS
this can be done by: 1. selecting a form element 2. selecting a form element and attribute 3. selecting the class of an element 4. selecting the id of an element
48
regex modifier that Perform a global match (find all matches rather than stopping after the first match)
describe the javascript regex modifier **g**
49
regex: `/^fox$/`
write the regex that will match only the value "fox"
50
what is the syntax and parameters that will **attach an event handler to an element via javascripts addEventListener() method**
Syntax: `element.addEventListener(event, function, useCapture)` @param event the event type we wish to have a function called for @parm function the javascript function that will be called on such an event @param useCapture a boolean used for bubbling
51
describe the form element and syntax of **textarea**
This is a form element that can be used to collect a large piece of text from the user such as a comment or review Syntax: ``
52
this Tests for a match in a string. Returns the first match
describe the regex method **exec()**
53
is a CSS selector that is used to select the element that has focus. syntax: ``` :focus { css declarations; } ```
describe the following CSS selector and its syntax **focus**
54
describe the **multiple attribute ** of the form element ``
this attribute specifies that multiple item may be selected from the dropdown list by the user using CTRL it also specifies how many options are shown at a time
55
is the charcter used to anchor the regex to the end of the value
describe the javascript regex anchor **$**
56
describe the following `` type and write its syntax **email**
Works similar to the text input type except allows for limited email validation on the client side by the browser Syntax: ``
57
describe the regex method **exec()**
this Tests for a match in a string. Returns the first match
58
we can check this using ``
in HTML how can we check if javascript has been disabled on the client
59
the reason for this is: 1.**Accessibility** - a screen reader for example can associate the label and input 2.**Usability/accessibility** - the label itself acts as a clickable element for focusing on the input this increases the clickable area of the input (especially good for radio buttons)
when we have used an `` tag why should we always have a `` tag associated with it
60
is a property of the event object and will return the type of event that was triggered
describe **event.type**
61
This `` attribute give the input an initial value or value to hold NOTE: this attribute will be sent to the server on submition of the form
describe the following attribute of the `` tag **Value = “”**
62
describe the javascript event **blur**
this javascript event occurs when an element loses focus for example the user clicks somewhere else on the page or field.
63
methods: 1. exec() 2. test() 3. toString()
name 3 javascript regex methods
64
Syntax: `element.addEventListener(event, function, useCapture)` @param event the event type we wish to have a function called for @parm function the javascript function that will be called on such an event @param useCapture a boolean used for bubbling
what is the syntax and parameters that will **attach an event handler to an element via javascripts addEventListener() method**
65
describe the javascript regex anchor **$**
is the charcter used to anchor the regex to the end of the value
66
This `` attribute states that it is a requirement that this input is filled before form is sent
describe the following attribute of the `` tag **Required **
67
describe the HTML form element ``
this Is a form element that can be placed within a form and can be used to collect different types of data from the user NOTE: This is a self closing element or empty element so for it to be xml compliant it must be manually closed
68
describe the following attribute of the `` tag **Checked**
This `` attribute will specify that this input element is selected by default
69
describe the following `` type and write its syntax **number**
can be used to collect numeric only data from the user Syntax: ``
70
describe **Event.target.id**
is a property of the event.target object and will return the id of the element
71
describe the javascript regex modifier **i**
regex modifier that Perform case-insensitive matching
72
describe **event.target.value**
is a property of the event.target object and will return the value that is held by the HTML element
73
write the HTML that creates a form with the onsubmit attribute that 1. calls a function named handleSubmit() 2. passes the function the target of the event 3. determines whether the form should be submitted or not
HTML: ``` ` @param script the script to be ran on submit
79
Similar to the radio input type but when each input shares the same name it becomes a group and the user can select multiple items from the checkbox group Syntax: ``
describe the following `` type and write its syntax **checkbox**
80
Syntax: `object.eventType = script;` @param object a html element @param eventType an event type such as onchange @param script a javascript function that has 1 argument passed to it being the evnt object
what is the syntax and parameters that will **attach an event handler to an element via javascript** (get a reference to the HTML element)
81
is a property of the event.target object and will return the id of the element
describe **Event.target.id**
82
describe the following attribute of the `` tag **Id = “”**
This `` attribute gives the element a unique id within the html NOTE: can be referenced by CSS, javascript and HTML tags such as ``
83
syntax: `/pattern/modifier(s);` Example: `var regex = /fox/i;`
what is the syntax for creating a regex object in javascript
84
This `` attribute will specify that this input element is selected by default
describe the following attribute of the `` tag **Checked**
85
Creates a submit button and is used to submit the form NOTE: this itself can also hold a name and a value attribute so on the server side we could have different behaviours depending upon these Syntax: ``
describe the following `` type and write its syntax **submit**
86
write a regex that will match values that end with 09
regex: `/09$/`
87
describe the **javascript regex anchor**
this will tie a regular expression to the start or end of the value NOTE: These are placed within the forward slashes with the pattern
88
describe the following `` type and write its syntax **submit**
Creates a submit button and is used to submit the form NOTE: this itself can also hold a name and a value attribute so on the server side we could have different behaviours depending upon these Syntax: ``
89
describe the following attribute of the `` tag **Maxlength = “”**
This `` attribute state a maximum number of characters for the input
90
Allows us to collect a short amount of text from the user such as their name. Syntax: ``
describe the following `` type and write its syntax **text**
91
method: Tests for a match in a string. Returns true or false
describe the regex method **test()**
92
describe **event.type**
is a property of the event object and will return the type of event that was triggered
93
write the syntax to select an input element in CSS
syntax: ``` input { declaration; } ```
94
Works similar to the text input type except allows for limited email validation on the client side by the browser Syntax: ``
describe the following `` type and write its syntax **email**
95
this javascript event occurs when the value of an element changes, each time it happens, for example on every keypress. NOTE: This event may not be supported in all web browsers, and the user may not welcome feedback before they have finished entering data
describe the javascript event **input**
96
describe the javascript event **focus**
this javascript event occurs when an element gets focus for example the user uses the Tab key to ‘tab’ to an input or clicks on a text input or its label.
97
when we have used an `` tag why should we always have a `` tag associated with it
the reason for this is: 1.**Accessibility** - a screen reader for example can associate the label and input 2.**Usability/accessibility** - the label itself acts as a clickable element for focusing on the input this increases the clickable area of the input (especially good for radio buttons)
98
these include: ```