Add custom Javascript in Magento admin form

In previous post we learnt how to render custom html in tabs block. Now lets add custom JavaScript in Magento admin form. Magento is flexible enough to insert your custom JavaScript code snippets in forms created by your very own Magento modules & extensions. Continue reading “Add custom Javascript in Magento admin form”

Toggle checkboxes with jQuery and Prototype JS

Sometimes you work with forms having a long list of checkboxes, in such scenarios a “Check All” or “Toggle Selection” button comes handy. Such button can save your time by toggling your selection with one click.
Continue reading “Toggle checkboxes with jQuery and Prototype JS”

Post to your Facebook wall using Javascript SDK


<div id="fb_div">
    <h3>Post to your Facebook wall:</h3> <br />
    <textarea id="fb_message" name="fb_message" cols="70" rows="7"></textarea> <br />
    <input type="button" value="Post on Wall" onClick="post_on_wall();" />

Step 2:

window.fbAsyncInit = function()
        appId  : 'xxxxxxxxxxxxxxx',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true , // parse XFBML
        oauth : true // Enable oauth authentication


function post_on_wall()
        if (response.authResponse)
            alert('Logged in!');

            // Post message to your wall

            var opts = {
                message : document.getElementById('fb_message').value,
                name : 'Post Title',
                link : '',
                description : 'post description',
                picture : ''

            FB.api('/me/feed', 'post', opts, function(response)
                if (!response || response.error)
                    alert('Posting error occured');
                    alert('Success - Post ID: ' +;
            alert('Not logged in');
    }, { scope : 'publish_stream' });

create a div with id=”fb-root” and paste below code after this div

<div id="fb-root"></div>


(function() {
    var e = document.createElement('script');
    // replacing with an older version until FB fixes the cancel-login bug
    e.src = document.location.protocol + '//';
    //e.src = 'scripts/all.js';
    e.async = true;