How to verify a form is empty ? PHP or JS

Please, I'm a newbie in PHP, and created my web site, with a text form, i can verify with JQuery if the txt form is empty or not with the following code : \[code\] $(document).ready(function() { $('#formLike').ajaxForm({ target: '#content', beforeSubmit: validateForm }); //hide error containers $("#txtform_error").hide(); }); function validateForm() { $("#txtform_error").empty().hide(); var txtform = $("#txtform").val(); var errors = 0; if (txtform == null || txtform == '' || txtform == ' ') { $("#txtform_error").show().append("Please Write a Message Before Clicking : Like It"); document.formLike.txtform.focus(); } else { document.formLike.submit(); } }\[/code\]How to verify that the txt form is not empty, and there is not only white-spaces in the field, because here after submitting many white-spaces, the text is posted to the action page.Sorry for my bad english.Thanks in advance.
 
Back
Top