I have created a custom module and using hook_form_alter() to do the following-
<?php
$form['title']['#prefix'] = '<div id="title-ajax-check-wrapper">';
$form['title']['#suffix'] = '</div><div id="title-ajax-check-message"></div><div id="title-ajax-check-informer" class="title-ajax-check-informer"> </div>';
?>
Now in my js file i am using the following-
<?php
// $Id: title_ajax_check.js$
Drupal.behaviors.titleAjaxCheckBehavior = function (context) {
$('#title-ajax-check-wrapper input:not(.titleAjaxCheckBehavior-processed)', context)
.addClass('titleAjaxCheckBehavior-processed')
.each(function () {
var titleField = $(this);
var fieldPos = titleField.position();
var fieldWidth = titleField.width();
Drupal.CheckTitle = '';
$('#title-ajax-check-informer')
.css({left: (fieldPos.left+fieldWidth+10)+'px', top: (fieldPos.top)+'px'})
.show();
titleField
.keyup(function () {
if(titleField.val() != Drupal.CheckTitle) {
clearTimeout(Drupal.title-ajax-check-Timer);
Drupal.title-ajax-check-Timer = setTimeout(function () {title_ajax_check(titleField)}, Drupal.settings.TitleAjaxCheck.delay*1000);
if(!$("#title-ajax-check-informer").hasClass('title-ajax-check-informer-progress')) {
$("#title-ajax-check-informer")
.removeClass('title-ajax-check-informer-accepted')
.removeClass('title-ajax-check-informer-rejected');
}
$("#title-ajax-check-message")
.hide();
}
})
.blur(function () {
if(titleField.val() != Drupal.CheckTitle) {
title_ajax_check(titleField);
}
});
});
}
?>
But this javascript code is not working. When I inspect source code using firebug i do not see following part of above code being applied-
<?php
$('#title-ajax-check-informer')
.css({left: (fieldPos.left+fieldWidth+10)+'px', top: (fieldPos.top)+'px'})
.show();
?>
Can anybody help me here to rectify the problem, what i am doing wrong with this script.
Any help would be much appriciated.
Thanks