PDA

View Full Version : Update multiple fields in a record at once



mitchellsimoens
25 Jul 2010, 10:07 AM
Is there anyway to change


rec.set("name", name);
rec.set("date", date);

to


rec.set({
name: name,
date: date
});

meyerovb
25 Jul 2010, 4:00 PM
What data type is rec? How do you declare/fetch it?

evant
25 Jul 2010, 5:11 PM
No built in method, you could do:



var o = {
//
};
for(var prop in o){
rec.set(prop, o[prop]);
}