PDA

View Full Version : get/create all url with params from FormPanel



michalg
19 Aug 2009, 1:35 AM
hi,
I would like to get scaled url with params from FormPanel/Basic Form.
For example, for object - options:
method: Get,
url : service/users
params:

userName : Michal
city : london
I would like to receive href : service/users?userName=Michal&city=london

Can I use already implemented function in ext, or override that function, or mayby i have to implement it?

Condor
19 Aug 2009, 2:06 AM
What are you planning to do with this url (because both load() and sumbit() will create this url when called)?

You could do this manually with:

var action = new Ext.form.Action.Submit(formPanel.getForm(), {
url: 'service/users'
});
var url = action.getUrl(true);

michalg
19 Aug 2009, 2:29 AM
I use class (implementation found on forum) link button:



Ext.namespace('FN.COMMON');

/**
* @ptype linkbutton
*/

FN.COMMON.LinkButton = Ext.extend(Ext.Button, {
template: new Ext.Template(
'<table cellspacing="0" class="x-btn {3}"><tbody class="{4}">',
'<tr><td class="x-btn-tl"><i> </i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i> </i></td></tr>',
'<tr><td class="x-btn-ml"><i> </i></td><td class="x-btn-mc"><em class="{5}" unselectable="on"><a href="{6}" target="{7}" class="x-btn-text {2}"><button>{0}</button></a></em></td><td class="x-btn-mr"><i> </i></td></tr>',
'<tr><td class="x-btn-bl"><i> </i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i> </i></td></tr>',
'</tbody></table>').compile(),

buttonSelector : 'a:first',

getTemplateArgs: function() {
return Ext.Button.prototype.getTemplateArgs.apply(this).concat([this.href, "_self"]);
},

onClick : function(e){
if(e.button != 0){
return;
}
if(!this.disabled){
this.fireEvent("click", this, e);
if(this.handler){
this.handler.call(this.scope || this, this, e);
}
}
}
});

Ext.reg('linkbutton', FN.COMMON.LinkButton);And I want to dynamically change its href, use that url.

The best, i want to make that url dependent on count values in the form. So when user set only one value in the form I want only one parameter in url etc.