-
6 Jul 2008 1:11 PM #1
Ext.Button vs <input type="submit" name>. Need POST variable
Ext.Button vs <input type="submit" name>. Need POST variable
I need an Ext.Button equivalent to the following HTML
This HTML-based button submits POST variable named "button1" with a value "buttonOne".Code:<input type="submit" name="button1" value="buttonOne">
How to do this with Ext.Button?
The problem is that Ext.Button has no 'name' property and does not submit a POST variable.
-
6 Jul 2008 1:14 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Any reason why you couldn't put it in there?
Code:var myBtn = new Ext.Button({ ..// name : "myName', });
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
7 Jul 2008 9:14 AM #3
The only reason is that this does NOT submit 'name' as POST variable. It's useless.
With HTML-button <input type='submit' name='myname'>
'myname' will be submitted as POST.
I need the same for Ext.Button.
My situation: I have many buttons in a form. And I want to differ between submitting through different buttons. The easiest way to do this is to send a POST variable with pressing a button.
-
7 Jul 2008 9:46 AM #4
add an additional param to the request when the button is pressed. or add a hidden field to the form.
-
7 Jul 2008 9:56 AM #5
-
25 Sep 2008 7:24 AM #6
Send which button was pressed on SUBMIT
Send which button was pressed on SUBMIT
PHP Code:
var btnSubmit = new Ext.form.Hidden({id:'Submit', name:'Submit', value:''})
myDialog.add( btnSubmit );
function HandleSubmit( btn )
{
btnSubmit.setValue( btn.name );
myDialog.getForm().getEl().dom.submit();
}
-
25 Sep 2008 7:32 AM #7
Try
Code:Ext.SubmitButton = Ext.extend(Ext.Button, { template: new Ext.Template( '<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>', '<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><input type="submit" class="x-btn-text" name="{1}" value="{0}></td><td class="x-btn-right"><i>&#160;</i></td>', "</tr></tbody></table>"), onRender: function(ct, position){ var btn, targs = [this.text || ' ', this.name]; if(position){ btn = this.template.insertBefore(position, targs, true); }else{ btn = this.template.append(ct, targs, true); } var btnEl = btn.child("input:first"); btnEl.on('focus', this.onFocus, this); btnEl.on('blur', this.onBlur, this); this.initButtonEl(btn, btnEl); btn.un(this.clickEvent, this.onClick, this); Ext.ButtonToggleMgr.register(this); } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
25 Sep 2008 7:33 AM #8
The ampersand 160 things are supposed to be HTML entities ampesrand#160; to put a non breaking space in there, but the forum software doesn't like them.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
26 Sep 2008 12:38 AM #9
Oh, you'll also need
Code:.x-btn input { border: 0px none; background: transparent none repeat scroll 0 0; color: #333333; }Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
10 Oct 2008 3:39 AM #10
Animal, Well, after many tests, I could not get this to work. This is not button, this is input field, and text is editable there. But no click event works on this field. It does not submit the form.
But I solved the problem by posting an addition variable through a hide input field when pressing button.



Reply With Quote