Results 1 to 3 of 3

Thread: submit emty textarea

  1. #1
    Sencha User
    Join Date
    Mar 2017
    Posts
    3

    Default submit emty textarea

    Hi,

    i have a simple xtype: 'textarea' within a formpanel
    PHP Code:
      {
                          
    xtype'textarea',
                          
    name'description',
                          
    width'100%',
                          
    fieldLabel'Description',
                          
    labelWidth125,
                          
    margin'15 5 5 5'
                      



    Within the controller I have a save function. All formfields that changed shoud be submitted to the server.
    If I have a value in my textarea i can get the value by 'mpf.getForm().getFieldValues(true);'

    PHP Code:
    saveQuery: function(buttoncallbackskipColumns) {
                  var 
    mfp button.up('myformpanel');
                  var 
    record mfp.getForm().getRecord();
                  var 
    values mfp.getForm().getFieldValues(true); 

    This works fine until the textarea is not empty. But I also want to submit an empty textarea? How can I do that?

    Thank in advance

  2. #2
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    149
    Answers
    12

  3. #3
    Sencha MVP Team Member
    Join Date
    Sep 2016
    Location
    Kennewick, WA
    Posts
    147
    Answers
    15

    Default

    As you're using a save, I will assume you have crud defined in your model. In the model definition you have to specify
    Code:
    proxy: {
    type: 'ajax',
    api: {
    read: '/resources/teams.php?method=getTeams',
    create: '/resources/teams.php?method=addTeam',
    update: '/resources/teams.php?method=updateTeam',
    destroy: '/resources/teams.php?method=deleteTeam'
    },
    writer: {
    type: 'json',
    writeAllFields: true
    },
    reader: {
    type: 'json',
    rootProperty: 'teams'
    }
    }
    writeAllFields defaults to false whereby empty fields are not returned.
    Last edited by aallord; 26 Mar 2019 at 9:59 AM. Reason: Updated conclusion on writeAllFields
    Andy Allord
    Sencha MVP/Software Engineer

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •