Note that there are some explanatory texts on larger screens.

plurals
  1. POform validation. Radio button check doesn't work and some other problems in form
    primarykey
    data
    text
    <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;SignUp&lt;/title&gt; &lt;link rel="stylesheet" href="style/style.css"&gt; &lt;style type="text/css"&gt; #signup{ margin-left:200px; margin-top:90px; } #signup input{ margin:2px 0px 20px 10px; background-color:#EAEAEA; } #signup button{ font-size:16px; margin-top:50px; margin-left:150px; width:100px; height:31px; background-color:#333333; text-align:center; color:#FFF; } &lt;/style&gt; &lt;script&gt; function signup() { var x1=document.forms["signUpForm"]["username"].value; var x2=document.forms["signUpForm"]["email"].value; var x3=document.forms["signUpForm"]["password1"].value; var x4=document.forms["signUpForm"]["password2"].value; var x5=""; /* document.forms[0].radios is an array filled with all radio buttons. Loop through all of them and see if it is checked. If one is, transfer the value of that radio button to user_input.*/ var atpos=x2.indexOf("@"); var dotpos=x2.lastIndexOf("."); if(document.getElementById('gender_Male').checked) { x5="Male"; }else if(document.getElementById('gender_Female').checked) { x5="Female"; } if (x1==null || x1==""|| x2==null || x2==""|| x3==null || x3=="" || x4==null || x4=="" || x5=="") { alert("Please fill all the required fields"); return false; } else if (x3!=x4){ alert("Psswords do not match"); return false; } else if (atpos&lt;1 || dotpos&lt;atpos+2 || dotpos+2&gt;=x2.length) { alert("Not a valid e-mail address"); return false; } else{ return document.forms[0].action = "signupdata.php"; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php include_once("template_pageTop.php"); ?&gt; &lt;div id=signup&gt; &lt;h2&gt;Sign Up Here &lt;/h2&gt; &lt;form method="post" name="signUpForm" &gt; &lt;table border="0" cellpadding="2"&gt; &lt;tr&gt; &lt;td &gt;UserName:*&lt;/td&gt; &lt;td &gt;&lt;input type="text" name="username" size="30" &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Email:*&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="email" size="30" &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Password:*&lt;/td&gt; &lt;td&gt;&lt;input type="password" name="password1" size="30" &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Confirm Password:*&lt;/td&gt; &lt;td&gt;&lt;input type="password" name="password2" size="30" &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Gender:*&lt;/td&gt; &lt;td &gt;&lt;input type="radio" name="gender" value="male" id="gender_Male"&gt;Male&lt;br/&gt; &lt;input type="radio" name="gender" value="female" id="gender_Female"&gt;Female&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;button onclick= "signup()" &gt;SignUp&lt;/button&gt; &lt;/td&gt; &lt;td&gt;&lt;button type="reset" &gt;Cancel&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>There are several things I need to improve in this form.</p> <ol> <li>If there are no errors how to make the signup page visible.(After clicking signUp mine goes to a blank signupdata.php page.How to stop this)</li> <li>how to check if the radio button (gender) has been filled.My form desn't check that.</li> <li>When a field is not filled and after error message pops all the filled areas (including correctly filled) vanishes.Is there a way to stop this and keep all the correctly filled data.</li> </ol> <p>I am completely new to web design.Any help please.</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.
 

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