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

This is what I have already, just have a problem with question 1 and 2 <form act

ID: 3766811 • Letter: T

Question

This is what I have already, just have a problem with question 1 and 2

<form action = "FormProcessor.html" method = "get"
enctype = "application/x-www-form-urlencoded">
<p>Name<br />
<input type = "text" name = "visitor_name" size = "50"
value = "Enter your name" /></p>
<p>E-mail address<br />
<input type = "text" name = "e-mail" size = "50"
value = "Enter your e-mail address" /></p>
<p>Phone<br />
<input type = "text" name = "phone" size = "50"
value = "Enter your phone number" /></p>
<p>Area of town<br />
<input type = "text" name = "area" size = "50"
value = "What area of town are you
interested in?"/></p>
<p>Property <select name = "property_type">
<option value = "unselected">Select a Property Type</
option>
<option value = "condo">Condos</option>
<option value = "single">Single Family Homes</option>
<option value = "multi">Multifamily Homes</option>
<option value = "mobile">Mobile Homes</option>
<option value = "land">Land</option>
</select>
Sq. feet <input type = "text" name = "feet" size = "5"
value = "???" /> </p>
<p>Bedrooms <input type = "text" name = "bedrooms"
size = "5" value = "???" />
Maximum price <input type = "text" name = "price"
size = "12" value = "$$$" /></p>
<p>How should we contact you? <input type = "radio"
name = "contactHow" value = "call_me" /> Call me
<input type = "radio" name = "contactHow"
value = "e-mail_me" /> E-mail me</p>
<p><input type = "submit" /></p>
</form>


1. Add onclick event handlers to each <input> element
to check whether the value of the control is equal to its
default value. If so, then change the value to an empty
string (" "). For example, the onclick event handler for the
visitor_name <input> element is as follows:


)


2. Add validation code to the RealEstateInquiry.html document
that verifies the text boxes are not empty and do not contain
the default values when the form is submitted. For the square
feet, number of bedrooms, and maximum price fields, include validation code that verifi es the user entered a numeric value.
Also, add validation code that verifi es whether users have
selected values from the selection list and the radio button
group.


Explanation / Answer

Answer :

Validation Code :

<script type="text/javascript">
<!--
  
function validate()
{
  
if( document.myForm.visitor_name.value == "" )
{
alert( "Please provide your name!" );
document.myForm.visitor_name.focus() ;
return false;
}

if( document.myForm.e-mail.value == "" )
{
alert( "Please provide your Email!" );
document.myForm.e-mail.focus() ;
return false;
}
if( document.myForm.phone.value == "" )
{
   var phoneno = /^(?([0-9]{3}))?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
if((inputtxt.value.match(phoneno))
{
return true;
}
else{
alert( "Please provide your Mobile Number Properly!" );
document.myForm.phone.focus() ;
return false;
}
}
if( document.myForm.area.value == "" )
{
alert( "Please provide your Area!" );
document.myForm.area.focus() ;
return false;
}
if( document.myForm.property_type.value == "unselected" )
{
alert( "Please provide your property!" );
return false;
}
return( true );
}

if( document.myForm.feet.value == "" )
{
alert( "Please provide your Square Feet value!" );
document.myForm.feet.focus() ;
return false;
}
if( document.myForm.bedrooms.value == "" )
{
alert( "Please provide your Number Of Bedrooms value!" );
document.myForm.bedrooms.focus() ;
return false;
}
if( document.myForm.price.value == "" )
{
alert( "Please provide your Price value!" );
document.myForm.price.focus() ;
return false;
}
var r = document.getElementsByName("contactHow")
var c = "no_value"

for(var i=0; i < r.length; i++){
if(r[i].checked) {
c = i;
}
}
if (c == "no_value") alert("please select how to contact you.Thank You");


//-->
</script>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote