(b) The following HTML form allows a user to supply details for purchase of tickets for a concert. (Some of the options

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

(b) The following HTML form allows a user to supply details for purchase of tickets for a concert. (Some of the options

Post by answerhappygod »

B The Following Html Form Allows A User To Supply Details For Purchase Of Tickets For A Concert Some Of The Options 1
B The Following Html Form Allows A User To Supply Details For Purchase Of Tickets For A Concert Some Of The Options 1 (126.25 KiB) Viewed 28 times
(b) The following HTML form allows a user to supply details for purchase of tickets for a concert. (Some of the options from the select element have been omitted). When the submit button is clicked a JavaScript function called validate is invoked to check that the name fields contain data, the card number satisfies a CRC check and that the number of tickets is an integer in the range 1 to 10. <form action = "page2.jsp" method = "post" name = "forml" onsubmit = "validate()" > <table> <tr> <td> Name </td> <td> <input id = "n" name = "name"> </td> </tr> <tr> <td> Card number </td> <td> <input id = "C" name = "card"> </td> </tr> <tr> <td> Performance </td> <td> <select id = "p" name = "perf"> <option value = "1" selected> 2.30pm Aug 17 </option> <option value = "2"> 7.30pm Aug 17 </option> </select> </td> </tr> <tr> <td> Number of tickets </td> <td> <input id = "" name = "tickets"> </td> </tr> </table> <input type = "submit" value </form> "Book tickets" /> (1) Write a JavaScript function called validate that will perform the validation described above; it should display an appropriate alert if any input is invalid. You may assume a function to do the CRC check has already been written. (ii) Explain why it is desirable to perform both client-side and server-side validation of form data such as in the example above.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply