• 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.

[SOLVED] looking for a way to test result before show

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

  • [SOLVED] looking for a way to test result before show

    Hi,
    i have a application that is using the Metaform plugin to generate dynamic form fields.
    in this application, some fields are displayed when opening a ticket.
    (the fields to be displayed are dynamically selected by the user)
    everything works, except that i would like to avoid the display of the window when no fields are available... (now a blank window is displayed)
    (see attached screencaptures)

    i'd like to be able to test something the decide whether or not i perform a .show() or a .hide()

    Here's the definition of the window
    Code:
        var windowTemplate = new Ext.Window(
    	 	{id:'windowTemplate',
    		  x: 800,
       		  y: 100,
       		  height: 480,
        	  width: 400,  
        	  closeAction: 'hide',
        	  closable: false,
        	  items: 
        		{xtype:'metaform',
        		 id: 'IdMeta',
        		 autoScroll: true,
        		 url:'vvcall.pgm',		 
         		       baseParams:{pgm:'TDTK01R',
        				  	action:'getForm',
     					machine: machineTemplate
     						}
    		}
    	 }
    	);
    The function to load/show the window
    Code:
    var fcmachineTemplate = function(machineTmpl) {
    	machineTemplate=machineTmpl;
    	Ext.getCmp('IdMeta').getForm().baseParams.machine = machineTemplate;
    		
            Ext.getCmp('IdMeta').getForm().load();
    	windowTemplate.show();
    	};
    Location where the function is called
    Code:
    	....
    	fcmachineTemplate(data.TKCMACH);
    ...
    Attached Files

  • #2
    I would suggest you interrogate data.TKCMACH before calling fcmachineTemplate. If you don't find what you want, then you can take a different route, or maybe pop up a window that says there are no fields configured for display.

    Comment


    • #3
      i cannot test that... the data.TKMACH is used a key to get the data from iseries.

      it should indeed be possible to test the result from the vvcall. before the .show is performed.. but i don't know how to ...

      Comment


      • #4
        You can see what the metaform extends and there may be a load listener that you can interrogate. Otherwise a similar type of listener if it is not extending Ext.form.FormPanel.

        Worst case scenario, you'd have to customize the metaform extension you downloaded. Where did you get it from if I want to check it out?

        Comment


        • #5
          the metaform is an extension found from Extjs.eu

          maybe it is easier if we could setup a webmeeting?

          Comment


          • #6
            Sure. I'll go ahead and send you an email.

            Comment


            • #7
              Actually, I don't have your email, can you PM me your contact info?

              Comment


              • #8
                This was solved via ThierryC's trouble shooting. He confirmed over the phone he was making a separate call to determine validity prior to the call at issue.

                Comment


                • #9
                  I spoke with Thierry offline, and he was able to solve this one:

                  Code:
                  We did not have to change anything in the metaform.
                   
                  The metaform itself extends the  Ext.form.FormPanel..
                   
                   
                  This is the way we solved it; it needs an extra ajax call, but it works; and thats whats counts..
                   
                  thx
                   
                   
                  var fcmachineTemplate = function(machineTmpl){
                    machineTemplate=machineTmpl;
                    Ext.Ajax.request({
                       url:'vvcall.pgm',
                       params: {
                         pgm: 'TDTK01R',   
                         action: 'getFormVal',
                         machine: machineTemplate
                       },
                       success: function(response) {
                          var check = response.responseText;
                             if (check) {
                               var data = Ext.util.JSON.decode(response.responseText);
                                  if (data.show == 'J'){
                                    Ext.getCmp('IdMeta').getForm().baseParams.machine = machineTemplate;
                                    Ext.getCmp('IdMeta').getForm().load();
                                    windowTemplate.show();   
                                   }else {
                                     windowTemplate.hide();
                                   }
                               }
                            },
                            failure: function(response) {
                               windowTemplate.hide();
                            }
                        });
                   };

                  Comment

                  Working...
                  X