• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

form field not accepting input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • form field not accepting input

    I have a form with three fields. Two hidden fields and one text field. On Submit, the textfield never shows a value after doing
    var params = this.getMyform().getForm().getValues();

    results in the console always show as
    Object {SYSCODE: "1", SYSTRAN: "AAAADSD", NOTE: ""}

    the properties of the textfield are:
    xtype: 'textfield',
    name: 'NOTE',
    itemId: 'notesform_note',
    fieldStyle: 'text-transform:uppercase',
    emptyText: 'enter note text',
    maxLength: 50,
    enforceMaxLength: true,
    allowBlank: false

    too simple.. I'm baffled....

  • #2
    You'll need to post more of your code so we can see what's going on. Can you post the whole view and relevant controller methods?

    Comment


    • #3
      Code:
      //FORM
      Ext.define('DataEntry.view.NotesForm',{
          extend: 'Ext.form.Panel',
          alias: 'widget.notesform',
          
          initComponent: function(){
              var me=this;
              Ext.apply(me,{
                  frame: true,
                  defaults: {
                      anchor: '100%'
                  },
                  tbar: me.buildTbar(),
                  bbar: me.buildBbar(),
                  items: me.buildItems()
              });
              
              me.callParent(arguments);
          },
          
          buildTbar: function(){
              return [{
                  xtype: 'button',
                  text: 'Cancel',
                  itemId: 'notesform_cancelbutton',
                  iconCls: 'cancel'
              }];
          },
          
          buildBbar: function(){
              return [{
                  xtype: 'tbfill'
              },{
                  xtype: 'button',
                  text: 'Submit',
                  formBind: true,
                  itemId: 'notesform_submitbutton',
                  iconCls: 'accept'
              }];
          },
          
          buildItems: function(){
              return [{
                  xtype: 'hidden',
                  name: 'SYSCODE',
                  itemId: 'notesform_syscode'
              },{
                  xtype: 'hidden',
                  name: 'SYSTRAN',
                  itemId: 'notesform_systran'
              },{
                  xtype: 'textfield',
                  name: 'NOTE',
                  itemId: 'notesform_note',
                  fieldStyle: 'text-transform:uppercase',
                  emptyText: 'enter note text',
                  maxLength: 50,
                  enforceMaxLength: true,
                  allowBlank: false
              }];
          }
      });
      //controller code
      onAddNotesButton: function() {
      		var syscode = Ext.ComponentQuery.query('#invoicegrid_company')[0].getValue(),
      			systran = Ext.ComponentQuery.query('#pdfwindow_systran')[0].getValue(),
      			notesSys = this.getNotesForm().getForm().findField('SYSCODE'),
      			notesTran = this.getNotesForm().getForm().findField('SYSTRAN');
      
      		notesSys.setValue(syscode);
      		notesTran.setValue(systran);
      
      		if (!this.addNotesWindow) {
      			this.addNotesWindow = this.createAddNotesWindow();
      		}
      		this.addNotesWindow.show();
      	},
      	createAddNotesWindow: function() {
      		return Ext.create('Ext.window.Window', {
      			title: 'Add Notes',
      			layout: 'fit',
      			height: 200,
      			width: 400,
      			closeAction: 'hide',
      			closable: false,
      			modal: true,
      			items: [{
      				xtype: 'notesform',
      				flex: 1
      			}]
      		});
      	},
      
      
          onSaveNote: function(){
              Ext.getBody().mask('Saving...');
              var params = this.getNotesForm().getForm().getValues();
              console.log(params);
              Ext.apply(params, {
                  pgm: 'apentry',
                  action: 'save_Note'
              });
              this.addNotesWindow.hide();
              var me=this;
              Ext.Ajax.request({
                  scope: me,
                  url: 'vvcall.pgm',
                  params: params,
                  success: function(response){
                      Ext.getBody().unmask();
                      var resp = Ext.decode(response.responseText);
                      if(resp.SUCCESS === '1'){
                          me.getStore('Notes').load();
                          Valence.util.msg('Note','Saved');
                      }else{
                          Valence.util.msg('Error saving note','Not Saved');
                      }
                  },
                  failure: function(){
                      Ext.getBody().unmask();
                      alert('an error occurred');
                  }
              });
          }
      
      //app.js
      Ext.Loader.setConfig({
          enabled: true,
          disableCaching: true
      });
      
      
      Ext.application({
          requires: ['DataEntry.config.Settings'],
      	stores: [
              'Vendors', 'InvDetails', 'Invoices', 'Companys', 'Glmasts', 
              'LineItems', 'Periods', 'StatusCodes', 'Control', 'OpenBatchs', 
              'RouteNames', 'Notes'
          ],
      	controllers: [
              'Main', 'editInvoiceHeader', 'getNextBatchImage', 'getNextVoucher', 
              'displayInvoice', 'getCompanyName', 'getInvoice_Image', 'saveInvoice', 'setInvoiceForm',
              'getLineItems', 'setInvoiceFormButtons'
          ],
      	name: 'DataEntry',
      	appFolder: '/html/nocs-dev/AcctsPayable/DataEntry/app',
          launch: function(){
              Ext.create('DataEntry.view.NotesForm');
              Ext.create('DataEntry.view.Viewport');
          }
      });

      Comment


      • #4
        I think the problem is you are creating a new notes window each time. So sometimes you are probably getting the form values from a hidden notes window.

        In your createAddNotesWindow function, try showing the existing notes window if it exists.

        Otherwise, where you have Noteswindow.hide() you should close and destroy it, but the previous suggestion would be preferred.

        Comment


        • #5
          I'm not creating the notes window each time. Only once..

          if (!this.addNotesWindow) {
          this.addNotesWindow = this.createAddNotesWindow();
          } //the above will only be called one time

          also it happens on the 1st try, so there wouldn't be a hidden notes window at that point since the above gets run on the add note button.

          I did try and change the window property, closeAction: 'destroy'.. that didn't work either. I think the closeAction only gets fired when the close header tool is clicked. but it's set to closable: false, so it could never get clicked.

          just for fun i put a value property on the textfield other than a blank... that made it work... maybe this gives you a clue on what the real problem might be...
          however, if I key in anything the original value does not change on the submit.
          Last edited by mwmayer4; 08-25-2014, 11:44 AM.

          Comment


          • #6
            Originally posted by mwmayer4 View Post
            I'm not creating the notes window each time. Only once..

            if (!this.addNotesWindow) {
            this.addNotesWindow = this.createAddNotesWindow();
            } //the above will only be called one time
            Oops, missed that.

            Are you sure there aren't two instances of your form?
            Try an Ext.ComponentQuery.query('notesform'); and see if there are more than one.

            Can you post some screen shots too?

            Comment


            • #7
              Got it working... the only explanation I have at this point is that it did not like uppercase field names in the form... go figure...

              Comment

              Working...
              X