Jump to content

takes me to 404 page when posting with onsubmit javascript


scarhand

Recommended Posts

this works fine:

 

<form method="post" action="<?php bloginfo('url'); ?>/client-login">

 

but this does not:

 

<form method="post" action="<?php bloginfo('url'); ?>/client-login" onsubmit="return cllogin();">

 

if i add the onsubmit javascript it takes me to a 404 page after posting.

 

heres the js function:

 

function clregister()
{
  var errors = "";

  if (document.getElementById('name').value == '')
    errors += "- You must enter your name\n";

  if (document.getElementById('emailr').value == '')
    errors += "- You must enter your email\n";
    
  if (document.getElementById('passwordr').value == '')
    errors += "- You must enter your password\n";

  if (document.getElementById('phone').value == '')
    errors += "- You must enter your phone number\n";

  if (document.getElementById('address').value == '')
    errors += "- You must enter your address\n";

  if (document.getElementById('postcode').value == '')
    errors += "- You must enter your postcode\n";

  if (document.getElementById('agree').checked == false)
    errors += "- You must tick the box to agree to our TOS\n";
    
  if (errors == '')
  {  
    return true;
  }
  else
  {
    errors = "The following errors have occurred:\n\n" + errors + "\nPlease fill in these boxes and try registering in again.";
    
    alert(errors);
    
    return false;
  }    
}

 

this doesnt make any sense.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.