1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    6cef is on a distinguished road

      0  

    Default checkbox not showing as parameter?

    checkbox not showing as parameter?


    I'm using an Ext.form.field.Checkbox on a form. Here's me creating it:
    Code:
        var activeCheckbox = Ext.create('Ext.form.field.Checkbox', {
            id: 'detail-active',
            name: 'active',
            inputValue: 'x',
            uncheckedValue: 'y',
            fieldLabel: 'Active',
            labelAlign: 'top',
            submitValue: true
        })
    But on submission to my Java servlet, I don't see an "active" parameter. If I use a normal HTML checkbox it works.

    One thing, I have the checkbox embedded in a panel, with date & time selectors. The servlet picks those up as parameters.

    Looking at the generated source, I don't see name="active" attached to the ExtJS generated checkbox element, but I do with the date & time selector.

    Anyway, not sure if I'm missing something. Any help appreciated!

    -colin

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    With this:

    Code:
    new Ext.form.Panel({
        renderTo : document.body,
        url      : 'data/form.php',
        items    : [
            {
                xtype          : 'checkbox',
                name           : 'active',
                inputValue     : 'x',
                uncheckedValue : 'y',
                fieldLabel     : 'Active',
                labelAlign     : 'top',
                submitValue    : true
            },
            {
                xtype   : 'button',
                text    : 'Submit',
                handler : function(btn) {
                    var form = btn.up('form');
    
                    form.submit();
                }
            }
        ]
    });
    When I submit with it checked it sends active : x and when it's unchecked it sends active : y as expected for me.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.