Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Post Blog Form Validation (https://www.warriorforum.com/programming/756310-post-blog-form-validation.html)

bestseoexpert 20th February 2013 05:13 AM

Post Blog Form Validation
 
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!

nodesolomon 20th February 2013 06:43 AM

Re: Post Blog Form Validation
 
Quote:

Originally Posted by bestseoexpert (Post 7762388)
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");
});


bestseoexpert 22nd February 2013 06:47 AM

Re: Post Blog Form Validation
 
thx very much. but where to put them?

bestseoexpert 22nd February 2013 06:48 AM

Re: Post Blog Form Validation
 
and i am using wordpress


All times are GMT -6. The time now is 06:42 PM.