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

This is my code. I was wondering what I can do to set text limit on the username

ID: 3717110 • Letter: T

Question

This is my code. I was wondering what I can do to set text limit on the username and passwords. Also, if I don't choose a gender. I want a message that tells me to choose a gender. Please help. Would be helpful if you bold the designated codes.

<!DOCTYPE html>
<html>
<head>

<!--
Final Project - Gym Website
Professor Archibald
New York City College of Technology
  
Application Form
Author: Sujoy Sarkar
Date: April 25, 2018

Filename: application.html

-->

<body text="white"></body>

<p>
<img src="i.png" alt="Logo" width="800" height="400" />
  
<br/>

<a href="index.html"> About Us </a> &nbsp;&nbsp;&nbsp;
<a href="application.html"> Application Form </a> &nbsp;&nbsp;&nbsp;
<a href="direction.html"> Direction </a> &nbsp;&nbsp;&nbsp;


<title>Gym Application</title>

<script>

function doClear()
{
document.Application.fname.value = "";
document.Application.lname.value = "";
document.Application.address.value = "";
document.Application.city.value = "";
document.Application.state.value = "";
document.Application.zip.value = "";
document.Application.phone.value = "";
document.Application.email.value = "";
document.Application.threemonths[0].checked = false;
document.Application.sixmonths[1].checked = false;
document.Application.ninemonths[1].checked = false;
document.Application.yearly[1].checked = false;
document.Application.username[0].checked = false;
document.Application.password[1].checked = false;
document.Application.confirmpassword[2].checked = false;
return;
}

function doSubmit()
{
if (validateText() == false)
{
alert("Please complete your Billing Information.");
return;
}
if (validateRadio() == false)
{
alert("Please choose your membership type.");
return;
}
if (validateAccount() == false)
{
alert("Please create an account to complete your application.");
return;
}
alert("Your pizza order has been submitted.");
return;
}


function validateText()
{
var customer = document.Application.fname.value;
if (customer.length == 0) return false;

var customer = document.Application.lname.value;
if (customer.length == 0) return false;

var address = document.Application.address.value;
if (address.length == 0) return false;
  
var city = document.Application.city.value;
if (city.length == 0) return false;

var email = document.Application.email.value;
if (email.length == 0) return false;
}

//defination for ValidateForm()

function ValidateForm(form)
{
if ((form.gender[0].checked == false) && (form.gender[1].checked == false))
{
alert("Please choose your gender: Male or Female")
return false;
}
}

function Validation()
{
var a = document.Application.phone.value;
if (a == "")
{
alert("Please enter the contact number:");
document.form.phone.focus();
return false;
}
var a = document.Application.username.value;
if (a == "")
{
alert("Please enter your name:");
document.form.name.focus();
return false;
}
}


function validateRadio()
{
var getMembershipPeriod = document.getElementsByName("membershipPeriod");
for (var i = 0; i < getMembershipPeriod.length; i++)
{
if (getMembershipPeriod[i].checked == false)
{}
else
{
return true;
}
}
return false;
}


function validateAccount()
{
var username = document.getElementById("username").value;
if (username == "")
{
alert("Please enter your Username");
return false;
}
var password = document.getElementById("pass").value;
if (password == "")
{
alert("Please enter your password");
return false;
}
var CPassword = document.getElementById("confirmpass").value;
if (CPassword == "")
{
alert("Please re-enter your password");
return false;
}
}

</script>
</head>

<body>

<form name="Application">

<h1>Your Information</h1>
<p>


<h4>Details:</h4> <font face="Courier New">
First Name: &nbsp;&nbsp;&nbsp; <input name="fname" size="50" type="text">
<br>
Last Name: &nbsp;&nbsp;&nbsp;&nbsp; <input name="lname" size="50" type="text">
<br>
Address: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="address" size="50" type="text">
<br>
City: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="city" size="50" type="text">
<br>
State: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="state" size="50" type="TEXT">
<br>
Zip: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="zip" size="5" type="text">
<br>
Phone: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="phone" size="50" type="text">
<br>
Email: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="email" size="50" type="text">
<br>
</font>
</p>

<form name="feedback" action="#" method="post">
Your Gender:
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="Female"> Female
</form>

<p>
<h4>Membership:</h4> <font face="Courier New">
<input name="membershipPeriod" type="radio"> 3 Months - $30.00
<br>
<input name="membershipPeriod" type="radio"> 6 Months - $60.00
<br>
<input name="membershipPeriod" type="radio"> 9 Months - $90.00
<br>
<input name="membershipPeriod" type="radio"> Yearly - $120.00
<br>
</font>
</p>

<p>
<h4>Create a Account:</h4>

<body>
<form name="username" method="post">
<tr>
<td>Create Username:</td>
<td><input type="text" id="username" name="name"></td>
</tr>
<br>
<form name="password" method="post">
<tr>
<td> Password: </td>
<td><input type="password" id="pass" name="pass"></td>
</tr>
<br>
<form name="confirmpassword" method="post">
<tr>
<td> Confirm Password: </td>
<td> <input type="password" id="confirmpass" name="confirmpass"> </td>
</tr>
</p>

<input type="button" value="Submit Order">
<input type="button" value="Clear Entries">

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

Explanation / Answer

<!DOCTYPE html>
<html>
<head>

<!--
    Final Project - Gym Website
    Professor Archibald
    New York City College of Technology
  
    Application Form
    Author: Sujoy Sarkar
    Date: April 25, 2018

Filename: application.html

-->

<body></body>

<p>
<img src="i.png" alt="Logo" width="800" height="400" />
  
<br/>

<a href="index.html"> About Us </a> &nbsp;&nbsp;&nbsp;
<a href="application.html"> Application Form </a> &nbsp;&nbsp;&nbsp;
<a href="direction.html"> Direction </a> &nbsp;&nbsp;&nbsp;


<title>Gym Application</title>

<script>

function doClear()
    {
        document.Application.fname.value = "";
        document.Application.lname.value = "";
        document.Application.address.value = "";
        document.Application.city.value = "";
        document.Application.state.value = "";
        document.Application.zip.value = "";
        document.Application.phone.value = "";
        document.Application.email.value = "";
        document.Application.threemonths[0].checked = false;
        document.Application.sixmonths[1].checked = false;
        document.Application.ninemonths[1].checked = false;
        document.Application.yearly[1].checked = false;
        document.Application.username[0].checked = false;
        document.Application.password[1].checked = false;
        document.Application.confirmpassword[2].checked = false;
        return;
    }

function doSubmit()
    {
        if (validateText() == false)
        {
            alert("Please complete your Billing Information.");
            return;
        }
        if(validateForm()==false){
           alert("Please choose your gender: Male or Female");
        }
        if (validateRadio() == false)
        {
            alert("Please choose your membership type.");
          
        }

        if (validateAccount() == false)
        {      

            alert("Please create an account to complete your application.");
            return;
        }
            alert("Your pizza order has been submitted.");
            return;
        }


function validateText()
    {
        var customer = document.Application.fname.value;
        if (customer.length == 0) return false;

        var customer = document.Application.lname.value;
        if (customer.length == 0) return false;

        var address = document.Application.address.value;
        if (address.length == 0) return false;
      
        var city = document.Application.city.value;
        if (city.length == 0) return false;

        var email = document.Application.email.value;
        if (email.length == 0) return false;
    }

//defination for ValidateForm()

function validateForm(form)
    {
    if ((document.getElementById("m").checked == false) && (document.getElementById("f").checked == false))
        {
          
            return false;
        }
    }

function validation()
    {
        var a = document.Application.phone.value;
        if (a == "")
        {
            alert("Please enter the contact number:");
            document.form.phone.focus();
            return false;
        }
        var a = document.Application.username.value;
        if (a == "")
        {
            alert("Please enter your name:");
            document.form.name.focus();
            return false;
        }
    }


function validateRadio()
    {
        var getMembershipPeriod = document.getElementsByName("membershipPeriod");
        for (var i = 0; i < getMembershipPeriod.length; i++)
        {
        if (getMembershipPeriod[i].checked == false)
            {}
        else
        {
            return true;
        }
        }
        return false;
    }


function validateAccount(form)
    {
        var username = document.getElementById("username").value;
        var password = document.getElementById("pass").value;
        var cPassword = document.getElementById("confirmpass").value;
        if (username == '')
        {
            alert("Please enter your Username");
            return false;
        }else if(username.length<6){
           alert("Username can't be less than 6.");
           return false;
        }
      
        if (password == '')
        {
            alert("Please enter your password");
            return false;
        }else if(password.length<6){
           alert("Password can't be less than 6.");
           return false;
        }
      
        if (CPassword == '')
        {
            alert("Please re-enter your password");
            return false;
        }else if(cPassword.length<6){
           alert("Password can't be less than 6.");
           return false;
        }else if (!(password.equals(cPassword))) {
           alert("Confirm Password didn't match.");
           return false;
        }
    }

</script>
</head>

<body>

<form name="Application">

<h1>Your Information</h1>
<p>


<h4>Details:</h4> <font face="Courier New">
    First Name: &nbsp;&nbsp;&nbsp; <input name="fname" size="50" type="text" >
    <br>
    Last Name: &nbsp;&nbsp;&nbsp;&nbsp; <input name="lname" size="50" type="text">
    <br>
    Address: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="address" size="50" type="text">
    <br>
    City: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="city" size="50" type="text">
    <br>
    State: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="state" size="50" type="TEXT">
    <br>
    Zip: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="zip" size="5" type="text">
    <br>
    Phone: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="phone" size="50" type="text">
    <br>
    Email: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="email" size="50" type="text">
    <br>
</font>
</p>

<form name="feedback" action="#" method="post">
Your Gender:
    <input type="radio" name="gender" value="male" id="m"> Male
    <input type="radio" name="gender" value="Female" id="f"> Female
</form>

<p>
<h4>Membership:</h4> <font face="Courier New">
    <input name="membershipPeriod" type="radio"> 3 Months - $30.00
    <br>
    <input name="membershipPeriod" type="radio"> 6 Months - $60.00
    <br>
    <input name="membershipPeriod" type="radio"> 9 Months - $90.00
    <br>
    <input name="membershipPeriod" type="radio"> Yearly - $120.00
    <br>
</font>
</p>

<p>
<h4>Create a Account:</h4>


    <form name="username" method="POST">
    <tr>
        <td>Create Username:</td>
        <td><input type="text" id="username" name="name" pattern=".{8,12}" required="required"></td>
    </tr>
    <br>

    <tr>
        <td> Password: </td>
        <td><input type="password" id="pass" name="pass" pattern=".{8,12}" required="required"></td>
    </tr>
    <br>
  
    <tr>
        <td> Confirm Password: </td>
        <td> <input type="password" id="confirmpass" name="confirmpass" pattern=".{8,12}" required="required"> </td>
    </tr>
</p>

<input type="button" value="Submit Order">
<input type="button" value="Clear Entries">

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

Full question needed to provide better solution.

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