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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.