Jump to content

javascript to validate a domain name in index, domainchecker


Thembi

Recommended Posts

this is my code:

 

<script>

 

function frmValidate()

{

 

var val=document.frmDomin.name.value;

if (/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.test(val)){

alert("Valid Domain Name");

return true;

}

else

{

alert("Enter Valid Domain Name");

val.name.focus();

return false;

}

}

</script>

 

 

code above validates a domain name then pop up a javascript window when button submit is clicked on my separate html form , but when i take the code to header.tpl for an example it has compatibility issues , when i put the {literal} tags around my code i have no errors but it doesn't work

 

I know whmcs has its own domain validation , but i would like to validate on the same page (for an example if i am in the index page i would like to validate there so that if the user`s domain is not valid a javascript window will popup and i wond be taken to domainchecker where i will see the error message )

 

is there anyone who can help me

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated