Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP: Please Help Me Fix This Code
#1
im trully fed up trying since and still cant get it done im trying to put this script on my wapsite but it showing syntax error and its the one i used in my blog http://ebkstore.idcrax.com only new modifications please help

Code:
<script type="text/javascript" >
function validateForm(theform) {
for (var i= 0; i<theform.elements.length;i++) {var element=theform.elements[i]; if (element.className.indexOf ("required") !=-1) {element.className ="required" ;
if (!isFilled(element)) {alert( "Please" +element.id); element.className += "
error"; element.focus(); return false; }
}
if (element.className.indexOf
("email" ) !=- 1) { element.className ="required" ;
if (!isEmail(element)) { alert( "Please check you have entered a valid email
address"); element.className += "
error" ; element.focus(); return false;
}
}
}
return true;
}
function isFilled (field) { if (field.value.length<1) { return false; } else { return true; } } function isEmail(field) { if (field.value.indexOf ("@" ) == - 1 || field.value.indexOf( "." ) == -1 ) { return false; } else { return true;} }
</ script >



@Dealwap @cheatex @mattizzy @Horlahcoded @youngjohn @Laive

Please @Dealwap move this thread to home page
#2
I'll be back. Let me check...
Always try not to spend tomorrow regretting what you should have done today! Smile
Reply
#3
(03-15-2017, 05:27 AM)Laive Wrote:
I'll be back. Let me check...


ok
Reply
#4
I think your error is from that part where you returned TRUE towards the end of the function. With that, JavaScript does not know exactly where to terminate and return a True value.

Also, since the code below is testing for a different thing, I think it should have a block of it's own:


Code:
if (element.className.indexOf
("required") !=-1)
{
element.className ="required" ;
}


Again, the error message for your email address is wrong. Go through your entire code and correct all these.
Always try not to spend tomorrow regretting what you should have done today! Smile
Reply
#5
(03-15-2017, 06:36 AM)Laive Wrote:
I think your error is from that part where you returned TRUE towards the end of the function. With that, JavaScript does not know exactly where to terminate and return a True value.

Also, since the code below is testing for a different thing, I think it should have a block of it's own:


Code:
if (element.className.indexOf
("required") !=-1)
{
element.className ="required" ;
}


Again, the error message for your email address is wrong. Go through your entire code and correct all these.


Thanks @Laive
Reply
#6
(03-15-2017, 07:22 AM)jonath45 Wrote:
Thanks @Laive


Let's know if it works...
Always try not to spend tomorrow regretting what you should have done today! Smile
Reply
#7
you are using "if" in dif places,i think after using the 1st "if" the remaining should be "else if". abi
LOVE IS THE GREATEST.
Writing exam? socialize relating to it @http://onlysage.Tk
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  HELP: Come And Help Me With This Code Dilfgem 17 455 07-03-2018, 08:58 PM
Last Post: Dilfgem
  HELP: Why Is This Code Not Working. Webmasters Check In! Thepreditor 6 308 08-16-2017, 09:26 PM
Last Post: jonath45
  ALERT:  Webmasters Why Is This Code Not Compiling. Evinsian 7 335 08-10-2017, 09:13 AM
Last Post: Evinsian
  FUN: Let Know Who Can Get This Code Gbedu 7 282 07-08-2017, 05:58 PM
Last Post: Topkeh
  Hello Coders , I Need This Code/script brainbaze 0 255 03-13-2017, 11:25 AM
Last Post: brainbaze
  Please Help With This Code Macloaded 0 141 01-21-2017, 11:33 PM
Last Post: Macloaded
  I Need Help With This JQuery Code maximus 6 352 01-04-2017, 06:12 PM
Last Post: maximus
  Shortest Code For Random Number Between 1 And N In Javascript dealwap 2 244 01-03-2017, 11:54 AM
Last Post: Aphatheology
  Javascript Text Editor Right In Your Browser In One Line Of Code smartlord 1 247 12-31-2016, 09:59 PM
Last Post: Voski
  HELP: How Can I Use This Javascript Code? Ali John Hp 13 665 10-29-2016, 08:30 PM
Last Post: Ali John Hp



Users browsing this thread: 2 Guest(s)

About Nigeria's Creative Talents

Nigeria's Creative Talents is an online community where every creative Nigerians can share ideas with themselves.

For any more information, please use our contact form.

              User Links

              Advertise