|
|
Assignment 3: HTML Form Data ProcessingDue date: 2007/10/18 submit this assignment online with a link from your default.aspx page to assignment 3. Delay of each day in your online submission will cost you 0.5 point. Count for 4 points
Resources:
Requirement:
Hint: replace(UserComment, Microsoft.VisualBasic.ControlChars.CrLf, "<br>")
Submission requirement:You need to submit both registration.htm and registration.aspx to your hosting web site.== Source Code for the Registration Form - Registration.htm == <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">< html xmlns="http://www.w3.org/1999/xhtml" >< head> <title>Untitled Page</title></ head>< body> <h1>Registration Form </h1> <form action="registration.aspx" method="post">Name: <input type="text" name="username" /> <p>Password: <input type="password" name="psw" /> </p> <p> <input type="checkbox" name="programming" /> Have programming experience </p>Choose Your Favorite Color <br /> <input type="radio" value="1" name="color" />Red<br /> <input type="radio" value="2" name="color" />Green<br /> <input type="radio" value="3" name="color" />Blue <p>Select all your skills (Use CTL key to select more than one item): <p> <select multiple="multiple" size="3" name="skills"> <option value="db" selected="selected">Database</option> <option value="wp">Web programming</option> <option value="sa">Analysis and design</option> <option value="ec">Electronic Commerce</option> <option value="ebiz">E-Business System</option> </select> </p> <p>Your comment: <br /> </p> <textarea name="comment" rows="5" cols="44"></textarea> <p> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </p> </form></ body></ html>
== registration.aspx (Partial code) == <% @ Page Language="VB" %><! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">< script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)Dim UserName As String UserName = Request.Params.Get( "username")UserName = UserName.Trim() If UserName = "" ThenLabel1.Text = "User Name cannot be blank!" & _ "<a href='registration.htm'>Back to the reg. page!</a>" ElseLabel1.Text = "Your name is: " & _Request.Params.Get( "username") End If Dim userComment As StringuserComment = Request.Params.Get( "comment")userComment = _ Replace(userComment, Microsoft.VisualBasic.ControlChars.CrLf, "<br>")Label1.Text &= "<p>" & userComment End Sub</ script>< html xmlns="http://www.w3.org/1999/xhtml" >< head runat="server"> <title>Untitled Page</title></ head>< body> <form id="form1" runat="server"> <div>Form Data Submitted <br /> <br /> <asp:Label ID="Label1" runat="server"></asp:Label> </div> </form></ body></ html>== End of Regisrtation.aspx == |