Using the solution from above, provide an external JavaScript code that will validate all the fields of the form using the following criteria: a) Name field must not be empty. b) Phone number must accept the regular expression pattern: "[0-9]{3}-[0-9]{3}- [0-9]{4}" c) Email address must not be empty and must be tested against the regular expression: /^\S+@\S+\.\S+$/ d) The Gender field field must not be empty. Use the following in the list: 1. Select an option 2. Female 3. Male 4. Prefer not to say e) The amount field must not be empty. It must only accept numeric entries between 1 and 1000 f) The Fund field must not be empty. Use the following in the list: 1. Select an option 2. Building 3. Accommodation 4. Food g) If validation passes, display an alert that captures all what the user has entered in the form as shown in Figure 2.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

About Pearson Charitable Foundation Pearson announced today that, to support and increase its efforts to maximise social impact, it will integrate its corporate responsibility activities and functions into its business and, as of 2015, will no longer fund the Pearson Charitable Foundation as the primary vehicle for its philanthropic and community activities. Having been informed of this change in its funding, the Foundation Board of Directors on November 17 passed a resolution to wind down its operations and close at the end of 2014. Since 2003, the Foundation has contributed more than $130 million to programs that improve learning opportunities for people throughout the United States and globally. Pearson Charitable Foundation Chief Executive, Mark Nieker, said: “The Foundation is proud of the contribution it has made for teachers and students around the globe in the course of our history, with the support of Pearson and our other funders. We would like to extend our thanks to the vast number of organizations, institutions, teachers and students we have had the privilege to work alongside.” Pearson is working with the Foundation team to facilitate the transition of the Foundation’s work and programs to ensure that the interests of its charitable partners and beneficiaries are protected. Some programs will draw to a close, while others will be taken forward by other charitable organizations that share the Foundation’s mission and values.

Design a contact form using HTML and CSS that resembles the one shown in Figure 1. Ensure placeholders are used as well.

Using the solution from above, provide an external JavaScript code that will validate all the fields of the form using the following criteria:

a) Name field must not be empty.

b) Phone number must accept the regular expression pattern: "[0-9]{3}-[0-9]{3}- [0-9]{4}"

c) Email address must not be empty and must be tested against the regular expression: /^\S+@\S+\.\S+$/

d) The Gender field field must not be empty. Use the following in the list:

1. Select an option

2. Female

3. Male

4. Prefer not to say

e) The amount field must not be empty. It must only accept numeric entries between 1 and 1000 f) The Fund field must not be empty. Use the following in the list:

1. Select an option

2. Building

3. Accommodation

4. Food g) If validation passes, display an alert that captures all what the user has entered in the form as shown in Figure 2.

Pearson Charity: Donation Form
Please complete the form. Mandatory fields are marked with a *
PERSONAL INFORMATION DETAILS
Name *
For example: John Doe
Phone*
For example: 012-345-6789
Email *
For example:user@domain.com
Gender*
Select an option
DONATION DETAILS
Amount*
Any amount between R1 - R1000
Select an option
Fund*
Donate
Figure 1- Source: Obaido (2020)
Transcribed Image Text:Pearson Charity: Donation Form Please complete the form. Mandatory fields are marked with a * PERSONAL INFORMATION DETAILS Name * For example: John Doe Phone* For example: 012-345-6789 Email * For example:user@domain.com Gender* Select an option DONATION DETAILS Amount* Any amount between R1 - R1000 Select an option Fund* Donate Figure 1- Source: Obaido (2020)
This page says
Pearson Charity: Donation Form
You've entered the following details:
Full Name: Kimberley Yu
Please complete the form. Mandatory fields are marked with a *
Phone number: 012-045-1234
PERSONAL INFORMATION DETAILS
Email: kimberley.yu@yahoo.com
Gender: female
Name *
Kimberley Yu
Amount: 10
Fund: Accomodation
012-045-1234
Phone*
Email *
kimberley.yu@yahoo.com
OK
Gender*
Female
DONATION DETAILS
10
Amount*
Fund*
Accomodation
Donate
Figure 2 - Source: Obaido (2020)
Transcribed Image Text:This page says Pearson Charity: Donation Form You've entered the following details: Full Name: Kimberley Yu Please complete the form. Mandatory fields are marked with a * Phone number: 012-045-1234 PERSONAL INFORMATION DETAILS Email: kimberley.yu@yahoo.com Gender: female Name * Kimberley Yu Amount: 10 Fund: Accomodation 012-045-1234 Phone* Email * kimberley.yu@yahoo.com OK Gender* Female DONATION DETAILS 10 Amount* Fund* Accomodation Donate Figure 2 - Source: Obaido (2020)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fundamentals of Robotics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage