Note that there are some explanatory texts on larger screens.

plurals
  1. POtext validation doesn't work if textbox has something in it
    primarykey
    data
    text
    <p>I set up some javascript to make sure all fields in a form work filled. For the most part it worked, empty field, error message. My problem comes when the textarea has something in it, my form is submitted, even though other fields may be empty. here is my code so far:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Employment&lt;/title&gt; &lt;link href="../printstyles.css" rel="stylesheet" type="text/css" media="print" /&gt; &lt;link href="../morlanslayout.css" rel="stylesheet" type="text/css" media="screen" /&gt; &lt;script type="text/javascript"&gt; function validateForm() { var x=document.forms["jobapp"]["firstname"].value; var x=document.forms["jobapp"]["lastname"].value; var x=document.forms["jobapp"]["address"].value; var x=document.forms["jobapp"]["city"].value; var x=document.forms["jobapp"]["planet"].value; var x=document.forms["jobapp"]["system"].value; var x=document.forms["jobapp"]["cluster"].value; var x=document.forms["jobapp"]["phone"].value; var x=document.forms["jobapp"]["email"].value; var x=document.forms["jobapp"]["resume"].value; if (x==null || x=="") { alert("All fields must be filled in"); return false; } } &lt;/script&gt; &lt;/head&gt; &lt;body class="container"&gt; &lt;div class="container"&gt; &lt;header&gt; &lt;a href="#"&gt;&lt;img src="../images/small-4128-598652.png" alt="Insert Logo Here" width="180" height="90" id="Insert_logo" /&gt;&lt;/a&gt; &lt;/header&gt; &lt;div class="sidebar1"&gt; &lt;aside&gt; &lt;a href="../morlansfamousshop.html" title="Homepage"&gt;Homepage&lt;/a&gt;&lt;br /&gt; &lt;a href="../wares/morlansfamouswares.html" title="Wares"&gt;Wares&lt;/a&gt;&lt;br /&gt; &lt;a href="../history/morlansfamoushistroy.html" title="Company History"&gt;Company History&lt;/a&gt;&lt;br /&gt; &lt;a href="../support/morlansfamoussupport.html" title="Support"&gt;Support&lt;/a&gt;&lt;br /&gt; &lt;a href="../employment/morlansfamousjobs.html" title="Employment"&gt;Employment&lt;/a&gt;&lt;br /&gt; &lt;a href="../contact/morlansfamouscontactinfo.html" title="Contact Page"&gt;Contact Us&lt;/a&gt;&lt;br /&gt; &lt;/aside&gt; &lt;/div&gt;&lt;!--end sidebar1--&gt; &lt;article class="content"&gt; &lt;section&gt; &lt;h1&gt;Employment&lt;/h1&gt; &lt;p&gt;Are you interested in employment at Morlans Famous Shop?, if you answered yes, just fill out the following form and Morlan will check out your qualifications.&lt;/p&gt; &lt;/section&gt; &lt;section&gt; &lt;form name="jobapp" action="../support/thankyou.html" onsubmit="return validateForm()" method="post"&gt; &lt;fieldset&gt; &lt;legend&gt;Mailing Address&lt;/legend&gt; &lt;label class="label" for="firstname"&gt;First Name:&lt;/label&gt; &lt;input class="input" type="text" name="firstname" id="firstname" size="25" maxlength="25" /&gt; &lt;br /&gt; &lt;label class="label" for="lastname"&gt;Last Name:&lt;/label&gt; &lt;input class="input" type="text" name="lastname" id="lastname" size="25" maxlength="25" /&gt; &lt;br /&gt; &lt;label class="label" for="address"&gt;Address:&lt;/label&gt; &lt;input class="input" type="text" name="address" id="address" size="100" maxlength="100" /&gt; &lt;br /&gt; &lt;label class="label" for="city"&gt;City/Station:&lt;/label&gt; &lt;input class="input" type="text" name="city" id="city" size="50" maxlength="50" /&gt; &lt;br /&gt; &lt;label class="label" for="planet"&gt;Planet:&lt;/label&gt; &lt;input class="input" type="text" name="planet" id="planet" size="50" maxlength="50" /&gt; &lt;br /&gt; &lt;label class="label" for="system"&gt;System:&lt;/label&gt; &lt;input class="input" type="text" name="system" id="system" size="50" maxlength="50" /&gt; &lt;br /&gt; &lt;label class="label" for="cluster"&gt;Cluster:&lt;/label&gt; &lt;input class="input" type="text" name="cluster" id="cluster" size="50" maxlength="50" /&gt; &lt;br /&gt; &lt;label class="label" for="phone"&gt;Phone Number:&lt;/label&gt; &lt;input class="input" type="text" name="phone" id="phone" size="50" maxlength="50" /&gt; &lt;br /&gt; &lt;label class="label" for="email"&gt;E-mail:&lt;/label&gt; &lt;input class="input" type="email" name="email" id="email" maxlength="35" placeholder="name@cmail.com"/&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt;Job Applies To (check all that apply)&lt;/legend&gt; &lt;input type="checkbox" name="job" id="shipping" value="shipping" checked="checked"/&gt; &lt;label for="shipping"&gt;Shipping&lt;/label&gt; &lt;br /&gt; &lt;input type="checkbox" name="job" id="cashier" value="cashier" /&gt; &lt;label for="cashier"&gt;Cashier&lt;/label&gt; &lt;br /&gt; &lt;input type="checkbox" name="job" id="security" value="security" /&gt; &lt;label for="security"&gt;Security&lt;/label&gt; &lt;br /&gt; &lt;/fieldset&gt; &lt;label for="resume"&gt;Paste Resume Here&lt;/label&gt; &lt;br /&gt; &lt;textarea name="resume" id="resume" rows="10" cols="60" placeholder="Please enter your resume here."&gt;&lt;/textarea&gt;&lt;!--end textareas on the same line that they start--&gt; &lt;br /&gt; &lt;input type="submit" value="Submit" /&gt; &lt;input type="reset" value="Reset" /&gt; &lt;/section&gt; &lt;/article&gt; &lt;footer&gt; &lt;p&gt;This is an &lt;a href="http://www.luzerne.edu" title="LCCC website" target="_blank"&gt;LCCC&lt;/a&gt; project for &lt;a href="http://cis.luzerne.edu/~ds0002/cis146/index" title="My website for CIS 146" target="_blank"&gt;CIS146&lt;/a&gt;&lt;/a&gt;&lt;/p&gt; &lt;/footer&gt; &lt;/div&gt;&lt;!--end container--&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>any help would be much appreciated</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload