jquery.validator.addmethod custom error message

How to implement a custom dynamic error message to your jQuery Validator method? $.validator.addMethod(“checkEmailAvailability”,function(value,element){ var result; $.ajax({ type: “POST”, async: false, url:”includes/ajax/check-availability.php”, data:{email:value}, dataType:”json”, success: function(response) { result=response.success; $.validator.messages.checkEmailAvailability=response.msg; } }); return result; }); In the above code the message for the validator method is set by using $.validator.messages.checkEmailAvailability=response.msg; where the response.msg is the message […]

How to prevent form submit on enter using jQuery

I had a client that pressed enter after typing in a form by mistake and kept saying that my script had an error. After disabling the form submission on enter key the problem vanished ūüôā Prevent form submit on enter script : $(document).keydown(function(evt) { var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : […]

Minimum Widths for the text container in Fluid Layouts

Minimum width for the text that flows around a floating element. A floating element takes space from the horizontal space from the text that flows around it.¬†If browser view port is small the horizontal space left for the text may only fit a word or two per line resulting in a ugly narrow column. The […]

Make phpMyAdmin work with Varnish Cache.

How to make phpMyAdmin work on Nginx server with Varnish Cache? Assuming you have configured Varnish Cache to drop cookies here is what you have to change to make¬†phpMyAdmin work properly¬†on your Nginx server. after you install phpMyAdmin¬†make a symbolic link sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www edit /etc/varnish/default.vcl – add in ¬†sub vcl_recv if (req.url […]