1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    3
    Vote Rating
    0
    stek2012 is on a distinguished road

      0  

    Default Unanswered: Submit form: value of radio-field

    Unanswered: Submit form: value of radio-field


    Hello,

    I've defined form with a radio-field in a vbox container, like this:

    Code:
       
    flex: 2,
    xtype:    'formpanel',
    id: 'channel', 
    scrollable: 'vertical', 
     items: [
      {
        xtype: 'radiofield',
        name : 'channel',
        value: 'direct',
        label: 'Direct',
        checked: true
       },
       {
         xtype: 'radiofield',
         name : 'channel',
         value: 'indirect',
         label: 'Indirect'
        }
    ]
    When I submit the form the value of the radio-field in the URL is always set to "on", where I would expect the value of the selected radio-button. The form is submitted like this:

    Code:
      
    var form = Ext.getCmp('channel');
    form.setStandardSubmit(true);
                                    
    var val = form.getValues();
    alert (val.channel);
                                    
    form.submit({
      url: 'http://myurl',
      waitMsg: 'Sending...',
      method: 'GET',
      success: function() {
        alert('form submitted successfully!');
      }    
    });
    The URL in de browsers address bar resolves to http://myurl?channel=on.
    The alert shows the correct value of the radio field. For text-fields the values in the URL look ok.

    What is the correct way to submit the value of the radio-field?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    Answers
    3161
    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 mitchellsimoens has much to be proud of

      0  

    Default


    This works if you do not use standardSubmit, looks like there is a bug.
    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.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    bradyr is on a distinguished road

      0  

    Default Doesn't work even without standardSubmit

    Doesn't work even without standardSubmit


    Doesn't work even without standardSubmit. I cannot get any value on submit other than <radioname> = on. Please advise, thanks!

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    bradyr is on a distinguished road

      0  

    Default More info

    More info


    Doesn't work even without standardSubmit. I cannot get any value on submit other than <radioname> = on. Please advise, thanks!]
    Syntax:
    form.submit({
    success: function(form, action) {
    Ext.Msg.alert('Success', action.result.msg);
    },
    failure: function(form, action) {
    Ext.Msg.alert('Failed', action.result.msg);
    }
    });