theitd icon

Joomla - Add Script/Stylesheets

theitd | PRO | 11/04/15 10:07:08 AM UTC | 0 ⭐ | 490 👁️ | Never ⏰ | []
PHP |

950 B

|

None

|

0 👍

/

0 👎

<?php
// Field CSS customisation
$style = 'span.optional, span.star {'
    . 'display: none;'
    . '}';
// Postcode Lookup
$javascript = 'jQuery(document).ready(function(){
        jQuery(\'#postcode_lookup\').getAddress({
        api_key: \'rEGHXMG9qUGt-V5u0cd-PA1941\', 
        check_key: true, 
            // Invoked if key fails check
            onFailedCheck: function () {
                $("#successStatus").html("Please manually enter your address");
            },
        output_fields:{
            line_1: \'#jform_profile_address1\',
            line_2: \'#jform_profile_address2\',
            line_3: \'#jform_profile_address2\',
            post_town: \'#jform_profile_city\',
            county: \'#jform_profile_region\',
            postcode: \'#jform_profile_postcode\'
        },
        button_class: \'btn btn-primary\',
        input_class: \'hasTooltip\'
    });
})';
$doc =& JFactory::getDocument();
$doc->addScript("/media/getaddress/jquery.getAddress-2.0.0.custom.js");
$doc->addScriptDeclaration( $javascript );
$doc->addStyleDeclaration( $style );
 
?>

Comments