PDA

View Full Version : Prototype.js Form.serialize() Equivalent?



cluettr
22 Jul 2007, 7:40 PM
Does Extjs have an equivalent function to the prototype.js Form.serialize(formid);?



function postComment()
{
var params = Form.serialize('formComment');
var randomnumber = Math.floor(Math.random()*100001);
var myAjax = new Ajax.Updater('info','rma/panel_tr_info.php?' + params + '&option=notes' + '&rnd=' + randomnumber,{method: 'post',asynchronous: true,evalScripts: true});
Sound.play('_sounds/ding_dong.wav');
}

dantheman
23 Jul 2007, 7:59 AM
// get an object with the form's values with:
var formVals = formObj.getValues();

// add other values
formVals.otherVal = "other value";


I've used this (for example) to set the baseParams in a dataStore based on form entries.

--dan

tryanDLS
23 Jul 2007, 8:11 AM
You could try Ext.Ajax.serializeForm() (or Ext.lib.Ajax.serializeForm, pre 1.1) - note this takes an html form name or element, not an Ext Element.

cluettr
23 Jul 2007, 8:32 AM
Sounds like Ext.lib.Ajax.serializeForm is the the most similar. Thanks Dan and Tim.