Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:50:30+00:00 2026-06-12T07:50:30+00:00

i used to use jquery validation plugin but because of lack of this plugin

  • 0

i used to use jquery validation plugin but because of lack of this plugin with wysiwyg plugins i wrote a simple script to validate my form

i tried to do it like this

function validateArticle(formData, jqForm, options) { 
  $('#errors').empty();
  if ($('#editor').val() == 0) { 
    $('#errors').show();
    $('#errors').append('<li>please enter your article body</li>');
    return false; 
  } 
  if ($('#ArticleTitle').val() == 0) { 
    $('#errors').show();
    $('#errors').append('<li>please enter your article title</li>');
    return false; 
  }
  $('#errors').hide();
  return true ;
}

i found to 1 problem when it validate the form it’s validating it field by field so the errors messages doesn’t appear at once

i tried to do something like

var errors = [];
function validateArticle(formData, jqForm, options) { 
  $('#errors').empty();
  if ($('#editor').val() == 0) { 
    errors.push('<li>please enter your article body</li>');
    var invalid = 1 ;
    return false; 
  } 
  if ($('#ArticleTitle').val() == 0) { 
    errors.push('<li>please enter your article title</li>');
    var invalid = 1 ;
    return false; 
  }
  if(invalid == 1){
    $.each(errors , function(i, val) { 
      $('#errors').append(errors [i]); 
    });
  }

  $('#errors').hide();
  return true ;
}

i tried to push errors as array elements and loop through them in case of invalid is true
bu this one doesn’t work at it all ?

is there any way to make it work ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:50:32+00:00Added an answer on June 12, 2026 at 7:50 am
    if ($('#editor').val() == 0)   // This is checking if value is 0
    

    This does not make sense..
    Try

    if ($('#editor').val() == '') //Instead check for empty string
    

    EDIT
    Also you seem to be hiding the error’s div in the end.

     $('#errors').hide();
    

    Try this code Instead

    $('#validate').on('click', function() {
        var errors = [];
        var html = '<ul>' ;
        valid = true;
        $('#errors').empty();
        if ($('#editor').val() == '') {
            errors.push('<li>please enter your article body</li>');
            valid = false;
        }
        if ($('#ArticleTitle').val() == '') {
            errors.push('<li>please enter your article title</li>');
             valid = false;
        }
        if (!valid) {
            html += errors.join('') + '</ul>' 
                $('#errors').append(html);
    
        }
        else{
            $('#errors').hide();
        }
        return valid;
    });​
    

    DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

someone has used this jquery plugin for form validation? http://docs.jquery.com/Plugins/Validation i cant figure out
I used to use this script for jquery email obfuscation: $(.replaceAt).replaceWith(@); $(.obfuscate).each(function () {
I originally used JQuery for this project, but now I'm having to use Prototype,
The jQuery Validation plugin works great and is very easy to use: $(".selector").validate({ })
I'm trying to use the Jquery validation plugin to validate my form. I have
I used jquery validation for front-end data validate. But i need to do validate
I'm trying to use $(button).button(); but jquery-ui-1.8.16.custom.min.js used by SlickGrid doesn't have the button
hope you can help me on this one, I'm currently using this: jQuery plugin:validation
I'd like to validate a form using the jquery validate plugin, but I'm unable
I am using this form validator (http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/) and am having issues getting it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.