Search for question
Question

7.3C: Form Validation

Tasks

You are required to complete a simple form where the user can input a number of fields, simulating a page where a student could register for help on a given unit.

The form should ask for 4 separate fields, as shown in the figure below.

Write a javascript function that allows the data entered by the user to be validated, and where there is an error (the user has input data in an incorrect format) the form should be updated showing the correct format.

What will you submit?

You should submit:

Screenshots (similar to the above examples) of the web page.

• HTML file of the web page with JavaScript.

Fig: 1

Fig: 2

Fig: 3

Fig: 4


Most Viewed Questions Of Web Designing And Development

A React Project to develop a web application in which Customer can login into the System (no need to implement login module) and in his Nav bar he/She has Reserve Table button. Once the customer clicks on that button a Page will appear which gives access to the customer to reserve a table. The Page should look like,


Question 1 (15 pts) For each of the following program fragments, give an analysis of the running time (using Big-Theta). Assume ‘sum’ and ‘n’ are initialized before running the fragment.


Question Five Write the HTML and the JavaScript code that validates a numeric input. The number entered by the user should be between 1 and 10. When the user enters an invalid value, the background of the input will be red and the sentence "The number should be between 1 and 10" will be displayed in red just after the form. Number: 66 register The number should be between 1 and 10


Server Database for Website Project Task In this task, you are required to create a web server that implements a simple Comments Server, with an interface to a simple database (file) and accepts requests from a user (client browser). These requests include a GET to display the contents of the database, and a POST to store a new record in the database. The database structure (schema) should support a record with the following fields:


Chapter 2: Summary Hands-On Practice Case Study Task 1: The Website Folder. Create a folder on your hard drive or portable storage device (thumb drive or SD card) called "yoga" to contain your Path of Light Yoga Studio web page files. Task 2: The Home Page. You will use a text editor to create the Home page for the Path of Light Yoga Studio website. The Home page is shown in Figure 2.46. Task 3: The Classes Page. Create the Classes page shown in Figure 2.47. A technique that improves productivity is to create new pages based on existing pages so that you can benefit from your previous work. Your new Classes page will use the index.html page as a starting point. Open the index.html page for the Path of Light Yoga Studio website in a text editor. Select File > Save As, and save the file with the new name of classes.html in the yoga folder. Now you are ready to edit the page. 1. Web Page Title. Modify the page title. Change the text contained between the <title> and </title> tags to the following: Path of Light Yoga Studio :: Classes 2. Wireframe Main Content. a. Delete the Home Page content paragraphs, unordered list, and contact information. b. Configure the following text in the heading 2 element: Yoga Classes


SIT774 Web Technologies and Development 10.1P: Server Database for Website Project Task In this task, you are required to create a web server that implements a simple Comments Server, with an interface to a simple database (file) and accepts requests from a user (client browser). These requests include a GET to display the contents of the database, and a POST to store a new record in the database. The database structure (schema) should support a record with the following fields: Name Type Name TEXT Title TEXT Comment TEXT email TEXT Steps Task 10.1P To complete this task, you are required to: 1. Make a standalone Node.js program (i.e., a createDB.js file) and execute it on the Node.js console to create and initialise a server side SQlite3 file database in the server folder. The database contains a table that is used to store the data sent from a form page of your own website (as described in the table above). 2. Make another Node.js program (i.e., a server.js file) in your Node.js server folder. This program is able to launch the server, accept the data sent from a form page of your website (in a POST request), save the received data into the database table, and display the table data upon the request from the client (i.e., a GET request). 3. Make necessary changes to a form page of your website (can be stored in a file index.html), so that it is also able to send a data retrieval request (e.g., a GET request message linked to a Get Users button) to the server in addition to sending the form data to the server using a POST message linked to a Save User button. 4. Launch the server by executing the Node.js program you made. 5. Visit the form web page of your website via the local Node.js server (e.g., 2022/T1 1/2 SIT774 Web Technologies and Development http://localhost: 3000/ which will retrieve the index.html page) using a web browser. 6. Enter data into the form and submit the form to the server (one or more times, by clicking a Save User button). The data should be saved in the server database table. 7. Within the form page, send a data retrieval request (e.g., by clicking a Get Users button) to the server. After receiving the request, the server retrieves data from the database table and displays the retrieved data in the browser. Hints Task 10.1P This task is similar to the example provided in the unit site. You will note the structure of the database table will be different (slightly) and there will need to be a change to the form inputs to match the `fields' expected in the database. What will you submit? You should submit: • Source code of the form web page of your website. • Source code of the Node.js file (i.e., the first createDB.js file) that creates a server file database with a table in it. • Source code of the Node.js server program file (i.e., the second server.js file). • Screenshot of the browser window showing the form web page with entered data. • Screenshot of the browser window showing the retrieved data from the database table after the data retrieval request is sent to the server. 2022/T1 2/2


Question One 1. In your own word, explain what are the differences between alert and prompt windows? 2. Using HTML and JavaScipt, provide a script for the below screenshot.


SIT774 Web Technologies and Development 9.2C: Create a Response Page Tasks You are provided with an online form that implements a simple Online Order Form for our fictitious dKin Pizza company. An example of the empty order form is shown in the screenshot below: 2022/T1 Task 9.2C First name dKin Pizza Order Form Thank you for choosing dkin Pizza! Please fill in the customer & pizza order details blelow. Customer Details Mark Delivery Address localhost:3000/order.html 123 Apple St City Geelong Email address your@email.address Pizza Selection Select your pizza: Select a size: Special requests: Please select a pizza type.... Last name Smith Submit State Choose... Mobile number 04XX XXXX O Extra-Large Large O Medium O Small Postcode ◆ 3216 Number of pizzas: O Extra Cheese O Roasted Garlic Thick Crust No Chilli oo Reset 1 0 x Task 9.2C Incognito ⠀ Task9.2.1 Example form layout Again, to assist, the HTML source code for this order page is found on the Ontrack website, in the task 9.2℃ through the Resources link found in the 1/4 SIT774 Web Technologies and Development bottom right-hand corner of the page. You are required to implement the express server code to process the content of the submitted pizza order form and to return a formatted response. This would be implemented in Node.js application program (i.e., a index.js file). When the order form is completed by the user it can then be submitted to the server for processing, using the inbuilt form submit mechanism to the route (API) address /order through a POST request. A sample of a completed pizza order (form) is shown below: ← 2022/T1 Task 9.2C → C Ⓒ localhost:3000/order.html dKin Pizza Order Form Thank you for choosing dkin Pizza! Please fill in the customer & pizza order details blelow. Customer Details First name Anna Delivery Address 331 Seawater Drive City Torquay Email address fishprincess74@gmail.com Pizza Selection Select your pizza: Select a size: Special requests: Marinara Pizza Last name Kelp Submit State VIC Mobile number 0411223344 O Extra-Large O Large Medium O Small ◆ Postcode 3228 Number of pizzas: ✔ Extra Cheese Roasted Garlic O Thick Crust ✔ No Chilli Reset 2 Task 9.2C Incognito x Task9.2.2 Example completed form The Node.js application program should process the data submitted in the form 2/4 SIT774 Web Technologies and Development (extracting the relevant fields form the request.body message) and return a formatted response similar that shown in the screenshot below: Hints Task 9.1P localhost:3000/order 2022/T1 Order Confirmation Thank you for your order received on: Wed Sep 08 2021 13:49:07 GMT+1000 (Australian Eastern Standard Time) Pizza Details • 2 x Medium Marinara Pizza [Options: Extra Cheese, No Chilli] Customer Details • Customer: Anna Kelp • Address: 331 Seawater Drive, Torquay, VIC, 3228 • Contact mobile: 0411223344 • Contact email: fishprincess74@gmail.com Estimated Delivery Time Delivery expected by 2:34:07 PM (9/8/2021) -- or the pizza is free! To return to the previous page to order another pizza, please click here: RETURN 0 oo Incognito X : Task 9.2C Task9.2.3 Example survey response NOTE: The processing of the form should include: 1. The current date/time the order was received. 2. The expected delivery time of the pizza (simply 45 minutes added to the current time). Some things to consider in completing this task: • The response page shown in here uses Bootstrap formatting, although you can use plain HTML/text responses if you wish. • In the server code, with the handling the POST request for the form, set a local variable to be the current Date object, (i.e., orderDate). Then when calculating the new delivery time (45 minutes in the future), create a new Date object and set it with the following function (which you can add to your index.js file): 3/4 SIT774 Web Technologies and Development function addMinutes (date, minutes) { return new Date(date.getTime() + minutes*60000); } This could be called with: js deliveryTime = let orderDate = new Date(); addMinutes ( orderDate, 45 ); • To display the date/time as a string (in the two formats shown in the screenshot above), look at the Date object methods date.tostring() and date.toLocaleDateString(). References on these methods can be found here: • https://developer.mozilla.org/en- 2022/T1 US/docs/Web/JavaScript/Reference/Global_Objects/Date • https://www.w3schools.com/jsref/jsref_tolocaledatestring.asp • https://developer.mozilla.org/en- What will you submit? You should submit: let US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString Task 9.2C • Source code of the Node.js file (i.e., the index.js file). • Screenshot of the browser window showing the form web page with entered customer and pizza data. • Screenshot of the browser window showing response message after the "Submit" button is clicked. 4/4


9. You are running a web server app in Ubuntu Server. Users complain that their browsers are loading webpages with errors. Where are you likely to find the log file where the web server reports its errors?


7.3C: Form Validation Tasks You are required to complete a simple form where the user can input a number of fields, simulating a page where a student could register for help on a given unit. The form should ask for 4 separate fields, as shown in the figure below. Write a javascript function that allows the data entered by the user to be validated, and where there is an error (the user has input data in an incorrect format) the form should be updated showing the correct format. What will you submit? You should submit: Screenshots (similar to the above examples) of the web page. • HTML file of the web page with JavaScript.