update query in symfony

$con = Propel::getConnection();

// select from…

$c1 = new Criteria();

$c1->add(FacilitiesBookingsPeer::FAB_ID, $fabId);

 

// update set

$c2 = new Criteria();

$c2->add(FacilitiesBookingsPeer::FAB_SLOTS, $newSlot);

BasePeer::doUpdate($c1, $c2, $con);

 

here in the code given above $c1 stands for “where” criteria of query

while $c2 stands for the fields to be updated. also you can add other fields to be updated if you want.

the last line of the code block “BasePeer::doUpdate($c1, $c2, $con);” remains as it is.  while the others are according to your table in action. here we have “FacilitiesBookingsPeer::FAB_SLOTS ”  FacilitiesBookingsPeer is table and  FAB_SLOTS is the field name to be updated

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 Calender

simple: validate url with javascript

function urlValidateF(theurl){
var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
if (tomatch.test(theurl)){
return true;
} else {
return false;
}
}

in_array function for javascript as seen in php

function in_array(needle, haystack, strict) {
    var found = false, key, strict = !!strict;

    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }

    return found;
}
Follow

Get every new post delivered to your Inbox.

Join 25 other followers