Forum : Please i am tired of waiting for your reply to my questions
Brief description  about Online courses   join in Online courses
View Clement  Osei Tutu 's Profile

Please i am tired of waiting for your reply to my questions

Dear sir,

I have mail you several times and posted a question on this discussion board but no one seems to reply me.

Because of this for past two weeks now i still not able to continue the course.

Thanks.

Clement osei.
Asked by Clement Osei Tutu | Feb 5, 2011 |  Reply now
Replies (2)
View clement osei-tutu 's Profile
Please sir,

This code is not working ...help me with the right code to validate.

Here is it

<html>
<head>
<title>My validation form</title>
<script type="text/javascript">

function validate(){

message=""
message=message+checkUsername()
message=message+checkEmail()
message=message+checkPassword()
message=message+checkPhone()
message=message+checkRadio()
message=message+checkComments()
message=message+checkDropdown()
if(message==""){
return true
}
else{
alert(message)
return false
}
}

function checkUsername(){
username=document.f1.Username.value
var error="";
var illegalChars=^w/; // allow letters,numbers and underscores
if(username==""){
message="You did not entered a username" + "\n"
f1.style.background='green';
return message
}
else if(illegalChars.test(username.value)){
message="You entered illegal username" + "\n"
f1.style.background='green';
return message
}
else if((username.value.length<6) || (username.value.length>30)){
message="your username is either less than 4 or more than 30,try it again" + "\n"
f1.style.background='green';
return message
}
}

function checkEmail(){
email=document.f1.Email.value
atPos=email.IndexOf("@")
stopPos=email.lastIndexOf(".")

var errror="";
if(email==""){
message="You did not enter a correct email address" + "\n"
f1.style.background='green';
return message
}

if (atPos==-1 || stopPos==-1){
message="You did not enter a correct email address" + "\n"
f1.style.background='green';
return message
}

if (stopPos<atPos){
message="You did not enter a correct email address" + "\n"
f1.style.background='green';
return message
}

if (stopPos-atPos==1){
message="You did not enter a correct email address" + "\n"
f1.style.background='green';
return message
}
}

function checkPassword(){
password=document.f1.Password.value
var error="";
var illegalChras=(/[\w_]/);//allow only letters and numbers

if(password.value==""){
message="you did not enter a password" +"\n"
f1.style.background='green';
return message
}

else if(illegalChars.test(password.value)){
message="you entered an illegal password" + "\n"
f1.style.background='green';
return message
}

else if((password.value.length<6) || (password.value.length>30)){
message="Your password is either less than 6 or more than 30,try it again" + "\n"
f1.style.background='green';
return message
}

else if(!((/[a-z]+/) && (/[A-Z]+/) && (/[0-9]+/))){
message="Your password should include at least one uppercase,lowercase and numeral" + "\n"
f1.style.background='green';
return message
}
}

function checkPhone(){
phone=document.f1.Phone.value

var error="";
var stripped=(/[\(\)\.\-\]/g,");
if(phone.value==""){
message="You did not enter your phone number" +"\n"
f1.style.background='green';
return message
}

else if(isNaN(parseInter(stripped))){
message="You did not enter your phone number" +"\n"
f1.style.background='green';
return message
}

else if(!(stripped.length==15)){
message="You should enter your phone number with area code" + "\n"
f1.style.background='green';
return message
}
}

function checkRadio(){
radio=document.f1.Radio.length
txt=""
for(i=0;i<radio;i++){
if(document.f1.Radio[i].checked){
txt=txt+document.f1.Radio[i].value + ""
}
}
if(txt==""){
message="you did not ticked any of the option" + "\n"
f1.style.background='green';
return message
}
}


function checkComments(){
comments=document.f1.Comments.value
var error="";
if(comments==""){
message="You must enter a comment" + "\n"
f1.style.background='green';
}
}

function GetSelectedItem() {
len = document.f1.s1.length
i = 0
chosen = "none"
for (i = 0; i < len; i++) {
if (document.f1.s1[i].selected) {
chosen = document.f1.s1[i].value
}
}

return chosen }
}


else{
f1.style.background='#3399ff';
}

</script>
</head>

<body>
<form name="f1" method="post" action="" onsubmit=" return validate()" enctype="text/plain">

<table border="0" cellspacing="0" cellpadding="0" align="center" valign="top" bgcolor="#3399ff" width="500">

<tr align="center" valign="top" width="200">
<td><p align="left">Username:<input type="text" name="name" size="30"></td>
</p>
</tr><br/>

<tr align="center" valign="top" width="200">
<td><p align="left">Email:<input type="text" name="email" size="30"></td>
</p>
</tr><br/>

<tr align="center" valign="top" width="200">
<td><p align="left">Password:<input type="text" name="password" size="30" maxlength="30"></td>
</p>
</tr><br/>

<tr align="center" valign="top" width="200">
<td><p align="left">Phone Number:<input type="text" name="phone" size="30"></td>
</p>
</tr><br/>

<tr align="center" valign="top" width="400">
<td><th><p align="left">Which cars is for your own.</th></td></p>
<td><p align="left">BMW:<input type="radio" name="Radio"></td></p>
<td><p align="left">Bens:<input type="radio" name="Radio"></td></p>
<td><p align="left">Ford:<input type="radio" name="Radio"></td></p>
</tr><br/>

<p>
<form name="s1">
<option value="hus" selected>House</ption>
<option value="bud">Building</option>
<option value="car">Car</option>
<option value="cump">Computer</option>
</select>
</p>
<tr align="center" valign="top" width="200">
<td><p align="left">Comments:<br/><textarea name="comment" size="40" cols="23" rows="15" wrap="virtual"></textarea></p>
</td>
</tr><br/>


<tr align="center" valign="top" width="400">
<td><p align="center">Submit:<input type="submit" name="submit" value="Submit"><br/>
Reset:<input type="reset" name="submit2" value="Reset"></p>
</td>
</tr>

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

Please i am looking forward for your reply.Please help give me all the codes that can work well...i beg you because this is my life and future.

Help me and i belief God will bless you.

Thanks
Clement Osei.
Feb 9, 2011
View teacher siliconindia 's Profile
Hi Clement,

Sorry for late reply.Let me check your query
Feb 7, 2011