Wednesday, April 7, 2010

Exercise 6

1. Design the form

“Retrofit” the form data string above:

name=Even+Burke&card=Visa&number=8443261344895544&order=French+perfume

for buying some French perfume into the HTML form fields and submit button on the Web Page form.

In basic HTML, the form data string can be created with.



Figure1(Sebesta, 2009). HTML code of Cars


Figure2(Sebesta, 2009). Display of HTML code


Reference
Sebesta,R.(2009). Programming World Wide Web. (5th ed, PP185-256).Boston, MA: USA.


2. Write the script

Script archives exist for PERL, Python and Javascript. Search the Web for a script that processes the HTML forms data. Read the code and list the steps involved in processing the form.

The list of the processing the HTML form are the follwing (Sebesta, 2009):

1. Give own form of a name attribute to make identification easier.

2. Change the submit button to be =button” for using JavaScript to submit the form.

3. Add an “onClick” attribute to the button, and identify a function of JavaScript for processing the button with form.

4. Write function of JavaScript that it generates the form by the submit button.

5. An advantage of this method provides user check validation before it is passed along.


References

Sebesta,R.(2009). Programming World Wide Web. (5th ed, PP185-256).Boston, MA: USA.

Foy, B.(2002). The Perl Review. Retrieved April 5, 2010 from http://www.theperlreview.com/Issues/The_Perl_Review_0_5.pdf


3. Can you modify the script to process the form

Here is the above HTML form, modified so that JavaScript is used to process it. I have also added one data validation by using the isNumberString function from the JavaWorld site to check if the credit card has only numbers entered.



Figure3(Sebesta, 2009). Script





Figure4(Sebesta, 2009). Adding JavaScript feature

Reference
Sebesta,R.(2009). Programming World Wide Web. (5th ed, PP185-256).Boston, MA: USA.



No comments:

Post a Comment