Page 1 of 1

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

Posted: Fri May 20, 2022 10:30 am
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 29 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.