Categories
Javascript PHP

jQuery Watermark shadow effect on Input box

How to create watermark / shadow effect on Input type textbox? How to get watermark using jQuery ?

using jQuery watermark on input box
You can add default text on form elements that look like watermarks or work as placeholders. Using jQuery and bit of CSS rules, you can easily achieve the watermark effect. This is very handy if you want to prevent unwanted information to be sent to the server, as can happen with the default watermark text. It’s really very simple using jQuery. There is no need to write long Javascript function to check the value and populating default text onblur/onfocus/onclick/onchange… etc.

A simple jQuery example to show you how to implement a watermark text effect on an input field.

Just follow three steps and it’s done.

1) Create textbox in your HTML file

<input type="text" name="zipCode" id="zipCode" value="Enter Zip Code" />

2) Create CSS class for Dim effect (watermarking theme)

.watermarkEffectText {
    color : #9B9B9B;
}

3) Javascript code

$( document ).ready(function() {
	// apply class
	$("#zipCode").addClass("watermarkEffectText")

	// set default value (If you've not assigned in HTML, else skip this line) 

	// assigning in HTML doesn't wait for DOM load, and reflects immediately
	.val("Enter Zip Code")

	// on gaining focus
	.focus(function() {

		if( $(this).val() == "Enter Zip Code" ) { // remove default value
			// remove class and value
			$(this).removeClass("watermarkEffectText").val("");
		}
	})
	// on loosing focus
	.blur(function() {
		if($(this).val() == "") {
			// set default value with watermark effect
			$(this).val("Enter Zip Code").addClass("watermarkEffectText");
		}
	});
});

1, 2, 3… it’s as simple to achieve watermark effect.

'Coz sharing is caring
Categories
PHP

Symfony – does not have a registered handler / out of free disk space

Last night I started getting down time alerts from New Relic on our Symfony based Application. Our production server went down and while investigating PuTTY started giving me “Out of disk space” error

Out of disk space

An error similar to:-

PHP Warning: file_put_contents() : Only 0 of 36492 bytes written, possibly out of free disk space in /usr/lib/php/framework/symfony/lib/autoload/sfSimpleAutoload.class.php on line 165

Looking into message a little closer I found that the server had ran out of disk space so after making some space and using “symfony cc” to clear the cache i thought that this would have resolved the problem, however i continued to get below message “does not have a registered handler” being presented.

Fatal error: Uncaught exception ‘sfConfigurationException’ with message ‘Configuration file “/usr/lib/php/framework/symfony/config/config/settings.yml, /home/portal/www/site/apps/frontend/config/settings.yml” does not have a registered handler.”

After investigating closely I found the cache was not cleared properly even after running ‘symfony cc’.

Clear the Cache

At the end, i had to clear the cache manually with below command :-

rm -fr cache/*

For some reason this seemed to work fine where as the “symfony cc” command didn’t work therefore the only conclusion that I could come up with is that when the server ran out of disk space it corrupted something in the symfony cache which either is not normally cleared with a “symfony cc” and as a result i needed to remove it completely so symfony could re-build it automatically.

'Coz sharing is caring