Submitting form after validations using jQuery
There is no need for submitflag. The validform function could simply return the value of validflag, which should be declared inside that function, not in the outer scope.


  In my form I put all input boxes and select into .valid1 class, all checkbox and radio buttons to .valid2 class. I am just wondering is there any way we can do this by putting all input sources under a single class.


Sure. You just need to adjust some of the dom selectors a little bit, so that they are specific enough to match the right kind of input, for example by adding a condition on the type attribute, to make sure that text input and checkboxes are correctly distinguished.