What should you do?

You are developing a Web page.
The user types a credit card number into an input control named cc and clicks a button named submit.
The submit button sends the credit card number to the server.
A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum.
You need to ensure that the form cannot be used to submit invalid credit card numbers to the server.
What should you do?

You are developing a Web page.
The user types a credit card number into an input control named cc and clicks a button named submit.
The submit button sends the credit card number to the server.
A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum.
You need to ensure that the form cannot be used to submit invalid credit card numbers to the server.
What should you do?

A.
Configure the input control to run on the server. On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.

B.
On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.

C.
Configure the input control and the submit button to run on the server. Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.

D.
On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.



Leave a Reply 0

Your email address will not be published. Required fields are marked *