Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The programming assignment is to validate an HTML form before the form informati

ID: 3625214 • Letter: T

Question

The programming assignment is to validate an HTML form before the form information is sent to a web server. The form will be submitted only if all information is complete. You should read the following directions carefully.

You are to ensure that all information is present before allowing the form to be submitted: all textboxes must have something in them, a group of radio buttons must have 1 of the radio buttons selected, and that any select elements have something other than the default item selected. If any information is missing, cancel the submission or simply keep it from being submitted, and inform the user that they need to fill out the form completely. Once all information is present, when the user clicks the button, the form will be submitted to the course web server.

You will need to modify the form tag to include the following attributes: method="post" and
action="http://legacy.jefferson.kctcs.edu/users/mark.prather/formhandler.asp"

You will also need to modify the form so that there is a button (either submit or generic) at the very button of the form; this is the button you will use to submit the form.

To get full credit, you must use a loop and array notation to access the textbox elements named txtStudent and the textbox elements named txtParent and verify that they have data in them. You may use whatever method you want to validate the other form elements (the radio buttons, the select elements, and the other textboxes not named as above).

The form you will use is here:
<html>
<head>
<title>Field Trip Consent Form</title>

</head>
<body>
<h1>Field Trip Consent Form</h1>
<script type="text/javascript>

</script>

<form>

<h2>Description of Trip</h2>
<p>Destination &nbsp;
<input type="text" name="destination" SIZE="50" /></p>

<p>Date of Trip &nbsp;
<select name="month">
<option selected value="Month">Month
<option value="Jan">Jan
<option value="Feb">Feb
<option value="Mar">Mar
<option value="Apr">Apr
<option value="May">May
<option value="Jun">Jun
<option value="Jul">Jul
<option value="Aug">Aug
<option value="Sep">Sep
<option value="Oct">Oct
<option value="Nov">Nov
<option value="Dec">Dec
</select>

<select name="day">
<option selected value="Day">Day
<option value="01">01
<option value="02">02
<option value="03">03
<option value="04">04
<option value="05">05
<option value="06">06
<option value="07">07
<option value="08">08
<option value="09">09
<option value="10">10
<option value="11">11
<option value="12">12
<option value="13">13
<option value="14">14
<option value="15">15

<option value="16">16
<option value="17">17
<option value="18">18
<option value="19">19
<option value="20">20
<option value="21">21
<option value="22">22
<option value="23">23
<option value="24">24
<option value="25">25
<option value="26">26
<option value="27">27
<option value="28">28
<option value="29">29
<option value="30">30
<option value="31">31
</select>

<input type="text" name="year" value="Year" SIZE="4" /></p>
<p>Purpose of Trip &nbsp;
<input type="text" name="description" SIZE="50" /></p>
<p>Duration: &nbsp;
<input type="radio" name="duration" value="half_day" />Half Day
<input type="radio" name="duration" value="full_day" />Full Day
<input type="radio" name="duration" value="overnight" />Overnight</p>
<h2>Student Information</h2>
<p>First Name &nbsp;
<input type="text" name="txtStudent" size="20" /></p>
<p>Last Name &nbsp;

<input type="text" name="txtStudent" size="20" /></p>
<p>Home Telephone &nbsp;
<input type="text" name="txtStudent" size="20" /></p>
<p>Physician &nbsp;
<input type="text" name="txtStudent" size="20" /></p>
<p>Physician Telephone &nbsp;
<input type="text" name="txtStudent" size="20" /></p>
<h2>Parental Information</h2>
<p>Mother's Name &nbsp;
<input type="text" name="txtParent" size="20" /></p>
<p>Mother's Work Phone &nbsp;

<input type="text" name="txtParent" size="20" /></p>
<p>Father's Name &nbsp;
<input type="text" name="txtParent" size="20" /></p>
<p>Father's Work Phone &nbsp;
<input type="text" name="txtParent" size="20" /></p>
<p><input type="radio" name="permission" value="yes" /> Permission is Granted &nbsp;
<input type="radio" name="permission" value="no" /> Permission is NOT Granted &nbsp;</p>

<br />
<!-- Add your button here !-->
<br />

</form>
</body>
</html>

Explanation / Answer

Please see this!! It will help you!!! http://www.cramster.com/answers-apr-11/computer-science/javascript-programming-assignment-validate-html-form-befor_1251104.aspx