Hi guys,

I have a simple javascript codes that will validate the form if some of the fields is empty.
The input fields that needs to be validated is "title", "title URL" and "description".

Below are the codes,
		function validateForm() {
			var title=document.forms["myform"]["title"].value;
			var url=document.forms["myform"]["url"].value;
			var description=document.forms["myform"]["description"].value;
			if (title==null || title=="") {
				alert("Title must be filled out");
				return false;
			if (url==null || url=="") {
				alert("Title URL must be filled out");
				return false;
			if (description==null || description=="") {
				alert("Description must be filled out");
				return false;
            (function ($) {
                // We'll use this to cache the progress bar node
                var pbar;
                // This flag determines if the upload has started
                var started = false;
                $(function () {
                    // Start progress tracking when the form is submitted
                    $('#upload-form').submit(function() {
                        // Hide the form
                        // Cache the progress bar
                        pbar = $('#progress-bar');
                        // Show the progress bar
                        // Initialize the jQuery UI plugin
                        // We know the upload is complete when the frame loads
                        $('#upload-frame').load(function () {
                            // This is to prevent infinite loop
                            // in case the upload is too fast
                            started = true;
                            // Do whatever you want when upload is complete
                            //alert('Upload Complete!');
                        // Start updating progress after a 1 second delay
                        setTimeout(function () {
                            // We pass the upload identifier to our function
                        }, 1000);
                function updateProgress(id) {
                    var time = new Date().getTime();
                    // Make a GET request to the server
                    // Pass our upload identifier as a parameter
                    // Also pass current time to prevent caching
                    $.get("<?php echo base_url('admin/admin2/getprogress'); ?>", { uid: id, t: time }, function (data) {
                        // Get the output as an integer
                        var progress = parseInt(data, 10);
                        if (progress < 100 || !started) {
                            // Determine if upload has started
                            started = progress < 100;
                            // If we aren't done or started, update again
                        // Update the progress bar percentage
                        // But only if we have started
                        started && pbar.progressbar('value', progress);
The validateForm() method should be called first for form validation before the jQuery codes.
The problem is when the 3 fields is filled out 'title', 'title url' and 'description',
when I press the submit button the 'descrition' field will popup the alert() message,
even though it's already filled out.

So what I'm doing wrong here?
Anyone would like to help me please.

Thanks in advance.