Jump to content

domain name min length not checked


cluster

Recommended Posts

thanks brian!

in my previous WP script I have used some further checks:

if(strlen($keyword) > 0)
{

if(strlen($keyword) < 2)
{
echo "<font color='#FF0000'>Error: The Domain name is too short.</font></br></br>";
}
elseif(strlen($keyword) > 63)
{
echo "<font color='#FF0000'>Error: Domain name is too long. Max 63 characters.</font></br></br>";
}
elseif(!preg_match("/^[a-zA-Z0-9\-]+$/", $keyword))
{
echo "<font color='#FF0000'>Error: Domain name cannot contain special characters.</font></br></br>";
}
elseif(preg_match("/^-|-$/", $keyword))
{
echo "<font color='#FF0000'>Error: Domain name cannot begin, or end with a hyphen.</font></br></br>";
}
else
...

Link to comment
Share on other sites

for the moment I could solve the problem with jquery

<script src='http://code.jquery.com/jquery-1.7.1.min.js'></script>

   <input type="text" id="message" value="" />
   <input type="button" id="sendButton" value="Send">

   <script>
   $(document).ready(function(){  

     var checkField;

     //checking the length of the value of message and assigning to a variable(checkField) on load
     checkField = $("input#message").val().length;  

     var enableDisableButton = function(){         
       if(checkField >= 3){
         $('#sendButton').removeAttr("disabled");
       } 
       else {
         $('#sendButton').attr("disabled","disabled");
       }
     }        

     //calling enableDisableButton() function on load
     enableDisableButton();            

     $('input#message').keyup(function(){ 
       //checking the length of the value of message and assigning to the variable(checkField) on keyup
       checkField = $("input#message").val().length;
       //calling enableDisableButton() function on keyup
       enableDisableButton();
     });
   });
   </script>

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