Post Blog Form Validation

3 replies
how do i validate the post form, for example, i want to make sure nobody can submit less then 300 words, no title less than 20 words etc?
And also it there a way that i can show the main category on a drop down menu and sun-category on another, instead of on the right side?
Thank You!
#blog #form #post #validation
  • Profile picture of the author nodesolomon
    Originally Posted by bestseoexpert View Post

    how do i validate the post form, for example, i want to make sure nobody can submit less then 300 words, no title less than 20 words etc?
    And also it there a way that i can show the main category on a drop down menu and sun-category on another, instead of on the right side?
    Thank You!
    you can either validate using javascript(jquery) instantly on the webpage, or if your using a server side language i.e. php you would have to refresh the page and then show the error(very annoying)

    in terms of using jquery something like this would work for counting the characters including spaces:

    HTML:

    Code:
    <input type="text" id="post_body" name="post_body">
    <input type="submit" id="check_before_posting" value="Submit">
    Javascript(JQUERY) :

    Code:
    // on submit click 
    $("#check_before_posting").click(function() { 
       // get body value length
       body_value = $("#post_body").val.length;
       // if less than 300 alert error
        if(body_value < 300)
            alert("This is not allowed, body less than 300 characters");
    });
    Signature

    read my collection of Famous Quotes
    Free Online Movies

    {{ DiscussionBoard.errors[7762627].message }}
  • {{ DiscussionBoard.errors[7772536].message }}
  • {{ DiscussionBoard.errors[7772541].message }}

Trending Topics