Ajax.Updater syntax

new Ajax.Updater(window.opener.document.getElementById(‘facilityBookingFrm’), saveBookingUrl, {asynchronous:true, evalScripts:true, method:’POST’, onComplete:function(request, json){ setCalendar(‘\”+objDateS+\”‘);  setTargetDate(‘event2’, ‘\”+objDateS+\”‘ ); timeSlotsArray = new Array(); timeSlotsConflictArray = new Array();  thirdClick = false; clearBoxes(0); eval(‘\”+evalToScript+\”‘); Calendar.setup({ inputField : ‘start_date’, ifFormat : ‘%b, %d %Y’, button : ‘f_trigger_c’, align : ‘Tl’, position : positionArr,  singleClick : true }); Calendar.setup({ inputField : ‘end_date’, ifFormat : ‘%b, %d %Y’, button : ‘e_trigger_c’, align : ‘Tl’, position : positionEArr,  singleClick : true }); }, onLoading:function(request, json){}, parameters: { startDate: fab_starttime, selectedSlot: selectedSlot, repeatWeekly: fab_repeat_weekly, repeatWeekday: fab_repeat_weekday, repeat: fab_repeat, reminder_tim: fab_sendreminder_type, reminder_mins: fab_sendreminder_beforemins, fac_id: fac_id, endDate: fab_endtime, selectedConflictSlot: selectedConSlot, reConflicts: reConflicts, currdateStr: currdateStr, otherHVar: otherHVar, conflictResol: ‘1’ } });

The syntax goes as follows:

new Ajax.Updater ( ‘elementToBeUpdated’, ‘urlInRequest’, { asynchronous:true, evalScripts:true /* true or false*/, method: ‘POST’ /*’POSTorGET’*/, onComplete:function(request, json){ /*Action after completion of request */ } , onLoading:function(request, json){ /*Action while loading */ }, parameters: { /* post parameters to be passed*/ } } )

getElementsByAttribute for Javascipt

document.getElementsByAttribute=function(attrN,attrV,multi){
attrV=attrV.replace(/\|/g,’\\|’).replace(/\[/g,’\\[‘).replace(/\(/g,’\\(‘).replace(/\+/g,’\\+’).replace(/\./g,’\\.’).replace(/\*/g,’\\*’).replace(/\?/g,’\\?’).replace(/\//g,’\\/’);
var
multi=typeof multi!=’undefined’?
multi:
false,
cIterate=document.getElementsByTagName(‘*’),
aResponse=[],
attr,
re=new RegExp(multi?’\\b’+attrV+’\\b’:’^’+attrV+’$’),
i=0,
elm;
while((elm=cIterate.item(i++))){
attr=elm.getAttributeNode(attrN);
if(attr &&
attr.specified &&
re.test(attr.value)
)
aResponse.push(elm);
}
return aResponse;
}

observe field in symfony

While using observe_field , pls take a note that never use ‘with’ => “‘regCode=’ + $(‘region’).value” instead of that  use :’with’ => “‘regCode=’+value” as the former method is incompatible with lower versions of firefox

echo(observe_field(‘region’, array(‘update’ => ‘updateCountry’, ‘url’ => ‘default/updateCountry?className=DrpDwnBox194FL’,’script’=>true, ‘with’ => “‘regCode=’ + $(‘region’).value”, ‘loading’  => “Element.show(‘loadingId’);Element.hide(‘updateCountry’)”, ‘complete’ => “Element.hide(‘loadingId’);Element.show(‘updateCountry’)”)));

——————
echo(observe_field(‘region’, array(‘update’ => ‘updateCountry’, ‘url’ => ‘default/updateCountry?className=DrpDwnBox194FL’,’script’=>true, ‘with’ => “‘regCode=’+value”, ‘loading’  => “Element.show(‘loadingId’);Element.hide(‘updateCountry’)”, ‘complete’ => “Element.hide(‘loadingId’);Element.show(‘updateCountry’)”)));

not implemented error in javascript for ie

i faced this error because i didn’t declared the javascript variable

function removeInviteDiv(divId){
if(!isNul(divId)){
parent = $(divId).parentNode;
//alert(‘here’+$(divId).parentNode);
thisDiv = $(divId);
parent.removeChild(thisDiv);
//alert(‘in’);
}
//alert(‘out’);
}

and then i changed the above code to the below one and it worked

function removeInviteDiv(divId){
if(!isNul(divId)){
var parent = $(divId).parentNode;
//alert(‘here’+$(divId).parentNode);
var thisDiv = $(divId);
parent.removeChild(thisDiv);
//alert(‘in’);
}
//alert(‘out’);
}

Javascript date object

The Date object allows you to work programatically with dates and times. You create a Date object using the Date constructor as shown in the syntax above and the available parameters are as follows:

milliseconds – an integer that represents the number of milliseconds since 01/01/70 00:00:00.

dateString – a string that represents the date in a format that is recognized by the Date.parse method.

yr_num, mo_num, day_num – an integer that represents the year, month or day of the date.

hr_num, min_num, sec_num, ms_num – an integer that represents the hours, minutes, seconds and milliseconds.

If you don’t supply any of the above parameters, JavaScript creates an object for today’s date according to the time on the local machine. If any arguments are supplied, you have to include the year, month and day as a minimum, with the time parameters being optional. Note that if you only supply some arguments, any not supplied are set to 0.

All dates are calculated in milliseconds from 01 January, 1970 00:00:00 Universal Time (UTC) with a day containing 86,400,000 milliseconds. The range of a Date object relative to 01/01/1970 (UTC) is -100,000,000 to 100,000,000 days and both Universal (UTC) time and Greenwich Mean Time (GMT) are supported.

The following code uses Date objects to calculate the time remaining, in days, to the start of the next millennium.

Code:
d = new Date()    //today’s date
mill=new Date(3000, 00, 01, 00, 00, 00)    //Next millennium start date
diff = mill-d    //difference in milliseconds
mtg = new String(diff/86400000)    //calculate days and convert to string
point=mtg.indexOf(“.”)    //find the decimal point
days=mtg.substring(0,point)    //get just the whole days
document.write(“There are only ” + days + ” days remaining to the start of the next millennium.”)

Output:
There are only 365033 days remaining to the start of the next millennium.

PROPERTIES

constructor Property
This property returns a reference to the function that created the Date object’s prototype.

Syntax: object.constructor

prototype Property
This property represents the prototype for the object’s class and can be used to add properties and methods to all instances of that class.

Syntax: object.prototype

METHODS

getDate Method
This method returns an integer (between 1 and 31) representing the day of the month for the specified (local time) date.

Syntax: object.getDate( )

getDay Method
This method returns an integer (0 for Sunday thru 6 for Saturday) representing the day of the week.

Syntax: object.getDay( )

getFullYear Method
This method returns an integer representing the year of a specified date. The integer returned is a four digit number, 1999, for example, and this method is to be prefered over getYear.

Syntax: object.getFullYear( )

getHours Method
This method returns an integer between 0 and 23 that represents the hour (local time) for the specified date.

Syntax: object.getHours( )

getMilliseconds Method
This method returns an integer between 0 and 999 that represents the milliseconds (local time) for the specified date.

Syntax: object.getMilliseconds( )

getMinutes Method
This method returns an integer between 0 and 59 that represents the minutes (local time) for the specified date.

Syntax: object.getMinutes( )

getMonth Method
This method returns an integer (0 for January thru 11 for December) that represents the month for the specified date.

Syntax: object.getMonth( )

getSeconds Method
This method returns an integer between 0 and 59 that represents the seconds (local time) for the specified date.

Syntax: object.getSeconds( )

getTime Method
This method returns a numeric value representing the number of milliseconds since midnight 01/01/1970 for the specified date.

Syntax: object.getTime( )

getTimezoneOffset Method
This method returns the difference in minutes between local time and Greenwich Mean Time. This value is not a constant, as you might think, because of the practice of using Daylight Saving Time.

Syntax: object.getTimezoneOffset( )

getUTCDate Method
This method returns an integer between 1 and 31 that represents the day of the month, according to universal time, for the specified date.

Syntax: object.getUTCDate( )

getUTCDay Method
This method returns an integer (0 for Sunday thru 6 for Saturday) that represents the day of the week, according to universal time, for the specified date.

Syntax: object.getUTCDay( )

getUTCFullYear Method
This method returns a four-digit absolute number that represents the year, according to universal time, for the supplied date.

Syntax: object.getUTCFullYear( )

getUTCHours Method
This method returns an integer between 0 and 23 that represents the hours, according to universal time, in the supplied date.

Syntax: object.getUTCHours( )

getUTCMilliseconds Method
This method returns an integer between 0 and 999 that represents the milliseconds, according to universal time, in the specified date.

Syntax: object.getUTCMilliseconds( )

getUTCMinutes Method
This method returns an integer between 0 and 59 that represents the minutes, in universal time, for the supplied date.

Syntax: object.getUTCMinutes( )

getUTCMonth Method
This method returns an integer, 0 for January thru 11 for December, according to universal time, for the specified date.

Syntax: object.getUTCMonth

getUTCSeconds Method
This method returns an integer between 0 and 59 that represents the seconds, according to universal time, for the specified date.

Syntax: object.getUTCSeconds( )

parse Method
This method returns takes a date string and returns the number of milliseconds since January 01 1970 00:00:00.

Syntax: Date.parse(dateString)

setDate Method
This method is used to set the day of the month, using an integer from 1 to 31, for the supplied date according to local time.

Syntax: object.setDate(dateVal)

setFullYear Method
This method is used to set the full year for the supplied date according to local time.

Syntax: object.setFullYear(yearVal [, monthVal, dayVal])

setHours Method
This method is used to set the hours for the supplied date according to local time.

Syntax: object.setHours(hoursVal [, minutesVal, secondsVal, msVal])

setMilliseconds Method
This method is used to set the milliseconds for the supplied date according to local time. The millisecondsVal parameter expects a number between 0 and 999 athough if this is exceeded, the setMilliseconds method will automatically increment other values in the Date object, e.g. if 1020 is specified, the seconds value is incremented by one and millisecondsVal is set to 20.

Syntax: object.setMilliseconds(millisecondsVal)

setMinutes Method
This method is used to set the minutes for the supplied date according to local time.

Syntax: object.setMinutes(minutesVal [, secondsVal, msVal])

setMonth Method
This method is used to set the month for the supplied date according to local time.

Syntax: object.setMonth(monthVal [, dayVal])

setSeconds Method
This method is used to set the seconds for the specified date according to local time.

Syntax: object.setSeconds(secondsVal [, msVal)

setTime Method
This method is used to set the time of a Date object according to local time. The timeVal argument is an integer that represents the number of milliseconds elapsed since 1 January 1970 00:00:00.

Syntax: object.setTime(timeVal)

setUTCDate Method
This method is used to set the day of the month, using an integer from 1 to 31, for the supplied date according to universal time.

Syntax: object.setUTCDate(dateVal)

setUTCFullYear Method
This method is used to set the full year for the supplied date according to universal time.

Syntax: document.setUTCFullYear( yearVal [, monthVal, dayVal])

setUTCHours Method
This method is used to set the hours for the supplied date according to universal time.

Syntax: object.setUTCHours(hoursVal [, minutesVal, secondsVal, msVal])

setUTCMilliseconds Method
This method is used to set the milliseconds for the supplied date according to universal time. The millisecondsVal parameter expects a number between 0 and 999 athough if this is exceeded, the setMilliseconds method will automatically increment other values in the Date object, e.g. if 1020 is specified, the seconds value is incremented by one and millisecondsVal is set to 20.

Syntax: object.setUTCMilliseconds(millisecondsVal)

setUTCMinutes Method
This method is used to set the minutes for the supplied date according to universal time.

Syntax: object.setUTCMinutes(minutesVal [, secondsVal, msVal])

setUTCMonth Method
This method is used to set the month for the supplied date according to universal time.

Syntax: object.setUTCMonth(monthVal [, dayVal])

setUTCSeconds Method
This method is used to set the seconds for the specified date according to universal time.

Syntax: object.setUTCSeconds(secondsVal [, msVal)

toGMTString Method
This method converts a local date to Greenwich Mean Time.

Syntax: object.toGMTString( )

toLocaleString Method
This method uses the relevant locale’s date conventions when converting a date to a string.

Syntax: object.toLocaleString( )

toSource Method
This method is used to return the source code that created the specified Date object.

Syntax: object.toSource( )

toString Method
This method returns a string that represents the Date object. This method is automatically called by JavaScript whenever a Date object needs to be displayed as text (as with many of the other methods of the Date object).

Syntax: object.toString( )

toUTCString Method
This method uses the universal time convention when converting a date to a string.

Syntax: object.toUTCString( )

UTC Method
This method returns the number of milliseconds from the date in a Date object since January 1, 1970 00:00:00 according to universal time. This is a static method of Date so the format is always Date.UTC() as opposed to objectName.UTC().

Syntax: Date.UTC(year, month, day [, hours, minutes, seconds, ms])

valueOf Method
This method is used to return a primitive value, as a number data type, of the specified Date object. This is returned as the number of millisecond since January 1, 1970 00:00:00.

Syntax: object.valueOf( )

tinyMCE text editor – complete buttons

Here’s the javascript for tinyMCE text editor
With this javascript you can have all the advanced features of tinyMCE text editor.

if you want to remove some of the features from you editor you can do so by removing the related tags or keywords used for that particular feature.

for example, if you want to remove the save feature from the first row – just remove the “save,” from the scirpt.

also “separator” is used for putting separator between different buttons

tinyMCE.init({
mode : “textareas”,
theme : “advanced”,
plugins : “safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,imagemanager,filemanager”,
theme_advanced_buttons1_add_before : “save,newdocument,separator”,
theme_advanced_buttons1_add : “fontselect,fontsizeselect”,
theme_advanced_buttons2_add : “separator,insertdate,inserttime,preview,separator,forecolor,backcolor”,
theme_advanced_buttons2_add_before: “cut,copy,paste,pastetext,pasteword,separator,search,replace,separator”,
theme_advanced_buttons3_add_before : “tablecontrols,separator”,
theme_advanced_buttons3_add : “emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen”,
theme_advanced_buttons4 : “insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage”,
theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,
theme_advanced_statusbar_location : “bottom”,
content_css : “/example_data/example_full.css”,
plugin_insertdate_dateFormat : “%Y-%m-%d”,
plugin_insertdate_timeFormat : “%H:%M:%S”,
external_link_list_url : “example_data/example_link_list.js”,
external_image_list_url : “example_data/example_image_list.js”,
flash_external_list_url : “example_data/example_flash_list.js”,
template_external_list_url : “example_data/example_template_list.js”,
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : true,
apply_source_formatting : true,
spellchecker_languages : “+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv”
});