• 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] parent.showMessage

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

  • [SOLVED] parent.showMessage

    I am testing my Valence 2.2 apps on Valence 3.0. They are still running as an EXTJS 3 app. When I try to add a record I am getting the following:
    Code:
    parent.showMessage is not a function
    [Break On This Error] 	
    
    parent.showMessage('', '<b><center>Record Added<\/b><\/center>');
    Is this function an EXTJS 3 function or a Valence 2 function?

  • #2
    I dug deeper and found it was in the Valence.js file. In version 3.0 I noticed that that parent.showMessage is commented out. If I reverse this change, will everything work okay or will this cause other problems?

    Comment


    • #3
      You can use Valence.util.msg(' ','Record Added');

      Comment


      • #4
        Will this work in Valence 2.2?

        Comment


        • #5
          I tried Valence.util.msg(' ','Record Added'); as you suggested and it does work in version 2.2 or version 3.0.

          I tried instead Valence.util.showMessage(' ','Record Added'); This worked in 2.2 but in 3.0 I do not get an error but the message is not displayed either.

          How can I get the message to display in version 3?

          Comment


          • #6
            So you tried
            Code:
            Valence.util.msg('','Record Added');
            and it did not work in version 3.0? If so is the browser logging any error?

            Thanks!

            Comment


            • #7
              It says the function is not defined or found.

              Comment


              • #8
                Do you have the valence-extjs4 script defined in your index file?

                Code:
                <script type="text/javascript" src="/vvresources/valence-extjs4.js"></script>

                Comment


                • #9
                  No. It is an EXTJS 3 application at the moment.

                  Comment


                  • #10
                    I have version 3 instance running so I can test as required. This is the message I get with Valence.util.msg.

                    Code:
                    Valence.util.msg is not a function
                    	
                    
                    Valence.util.msg(' ','Record Added');
                    Here is my code.
                    Code:
                    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
                    <html>
                        <head>
                            <meta name="generator" content="HTML Tidy, see www.w3.org">
                            <meta http-equiv="Content-Type" content= "text/html; charset=utf-8">
                            <meta name="Copyright" content= "Copyright 2008-2010 CNX Corporation, All Rights Reserved">
                            <title>Valence - AutoCode - Grid Maintenance
                                Template</title>
                            <link rel="stylesheet" type="text/css" href= "/extjs/resources/css/ext-all.css">
                            <link rel="stylesheet" type="text/css" href= "/vvresources/valence.css">
                            <script type="text/javascript" src= "/extjs/adapter/ext/ext-base.js">
                            </script>
                            <script type="text/javascript" src="/extjs/ext-all.js">
                            </script>
                            <script type="text/javascript" src="/vvresources/valence.js">
                            </script>
                            <script type="text/javascript" src="/Extensions/SuperBoxSelect.js">
                            </script>
                            <link href="/Extensions/superboxselect.css" media="screen" rel="Stylesheet" type="text/css" />
                            <script type="text/javascript">
                                
                                Ext.onReady(function(){
                                
                                    //### GLOBAL SETTINGS/VARIABLES ###################################################################
                                    parent.Valence.lang.lit.valenceContextHelp = 'AM/PM Relationship Management Solutions HELP';
                                    var vlit = parent.Valence.lang.lit;
                                    Ext.form.Field.prototype.msgTarget = 'under';
                                    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
                                    
                                    //### FUNCTIONS ###################################################################################
                                    
                                    // retrieve the authority for the user launching this program                                                       
                                    function fnCheckAuthority(){
                                        Ext.Ajax.request({
                                            url: 'vvcall.pgm',
                                            params: {
                                                pgm: 'APMEXPACT',
                                                action: 'getAuthority'
                                            },
                                            success: function(response){
                                                var check = response.responseText;
                                                if (check) {
                                                    var data = Ext.util.JSON.decode(response.responseText);
                                                    isOkToDelete = data.OKTODELETE;
                                                    isOkToUpdate = data.OKTOUPDATE;
                                                    if (data.OKTOADD != 'Y') {
                                                        Ext.getCmp('button_Add').hide();
                                                    }
                                                }
                                            }
                                        });
                                    }
                                    // function to handle adding a record...                                                                            
                                    //   if called with submit=true...then it will initiate the ajax call to the back-end program                       
                                    //   otherwise, simply display the add window                                                                       
                                    function fnAddRecord(submit){
                                        if (submit === true) {
                                            Ext.Ajax.request({
                                                url: 'vvcall.pgm',
                                                params: {
                                                    action: 'addRecord',
                                                    pgm: 'APMEXPACT',
                                                    AMNAME: Ext.getCmp('AMNAME').getValue(),
                                                    AMCNCTPRSN: Ext.getCmp('AMCNCTPRSN').getValue(),
                                                    AMOFCPHONE: Ext.getCmp('AMOFCPHONE').getValue(),
                                                    AMCELLPHON: Ext.getCmp('AMCELLPHON').getValue(),
                                                    AMEMAILADR: Ext.getCmp('AMEMAILADR').getValue(),
                                                    AINFLUENCR: Ext.getCmp('AINFLUENCR').getValue(),
                                                    ACCOMMENTS: Ext.getCmp('ACCOMMENTS').getValue(),
                                                    ACTIVITIES: '[' + Ext.getCmp('ACTIVITIES').getValue() + ']'
                                                },
                                                success: function(response){
                                                    var check = response.responseText;
                                                    if (check) {
                                                        var data = Ext.util.JSON.decode(response.responseText);
                                                        if (data.SUCCESS == '1') {
                                                            Valence.util.msg(' ','Record Added');
                    										Ext.getCmp('AMNAME').setValue('');
                                                            Ext.getCmp('AMCNCTPRSN').setValue('');
                                                            Ext.getCmp('AMOFCPHONE').setValue('');
                                                            Ext.getCmp('AMCELLPHON').setValue('');
                                                            Ext.getCmp('AMEMAILADR').setValue('');
                                                            Ext.getCmp('AINFLUENCR').setValue('');
                                                            Ext.getCmp('ACCOMMENTS').setValue('');
                                                            Ext.getCmp('ACTIVITIES').setValue('');
                                                            Ext.getCmp('tabpanels').setActiveTab("General");
                                                            tabs.render(document.body);
                                                        }
                                                        else {
                                                            try {
                                                                Ext.getCmp('tabpanels').setActiveTab(parseInt(data.TAB, 10));
                                                                Ext.getCmp(data.FLD).markInvalid(data.MSG);
                                                                Ext.getCmp(data.FLD).focus();
                                                            } 
                                                            catch (e) {
                                                                Ext.Msg.alert('Error', 'An error occured when attempting to add a new record');
                                                            }
                                                        }
                                                    }
                                                },
                                                failure: function(){
                                                    Ext.getBody().unmask();
                                                    Ext.Msg.alert('Failure', 'Failed to receive a response from server');
                                                }
                                            });
                                        }
                                        else {
                                            Ext.getCmp('tabs').show();
                                        }
                                    }
                                    // type-ahead data store
                                    var dsAMNAME = new Ext.data.JsonStore({
                                        autoLoad: false,
                                        url: 'vvcall.pgm',
                                        root: 'APAMSTLA',
                                        fields: ['AMNAME'],
                                        listeners: {
                                            beforeload: {
                                                fn: function(){
                                                    dsAMNAME.baseParams = {
                                                        pgm: 'apmexpact',
                                                        action: 'getSuggestion',
                                                        amname: Ext.get('AMNAME').getValue()
                                                    };
                                                }
                                            }
                                        }
                                    });
                                    
                                    //### WIDGETS/COMPONENTS ##########################################################################
                                    // new window which will be displayed when adding a record...                                                       
                                    //                                                                                                                  
                                    var tabs = new Ext.FormPanel({
                                        id: 'tabs',
                                        labelWidth: 110,
                                        border: false,
                                        width: 310,
                                        labelAlign: 'right',
                                        buttonAlign: 'center',
                                        autoScroll: true,
                                        tbar: [{
                                            text: 'Save',
                                            iconCls: 'save',
                                            handler: function(){
                                                fnAddRecord(true);
                                            }
                                        }, {
                                            xtype: 'tbfill'
                                        }, {
                                            text: vlit.help,
                                            tooltip: vlit.help,
                                            iconCls: 'help',
                                            handler: function(){
                                                parent.showHelp('/Help/apmexpacthelp.html');
                                            }
                                        }],
                                        items: {
                                            xtype: 'tabpanel',
                                            id: 'tabpanels',
                                            activeTab: 0,
                                            defaults: {
                                                autoHeight: true,
                                                bodyStyle: 'padding:10px',
                                                enableTabScroll: true
                                            },
                                            items: [{
                    							id: 'General',
                    							title: 'Express Setup',
                    							layout: 'form',
                    							defaults: {
                    								width: 330
                    							},
                    							defaultType: 'textfield',
                    							
                    							items: [{
                    								xtype: 'combo',
                    								fieldLabel: 'Name',
                    								id: 'AMNAME',
                    								store: dsAMNAME,
                    								displayField: 'AMNAME',
                    								hideTrigger: true,
                    								minChars: 0,
                    								loadingText: 'Loading...',
                    								autoCreate: {
                    									tag: 'input',
                    									maxlength: '40'
                    								}
                    							}, {
                    								id: 'AMCNCTPRSN',
                    								autoCreate: {
                    									tag: 'input',
                    									maxlength: '40'
                    								},
                    								fieldLabel: 'Contact Person'
                    							}, {
                    								id: 'AMOFCPHONE',
                    								autoCreate: {
                    									tag: 'input',
                    									maxlength: '20'
                    								},
                    								fieldLabel: 'Office Phone #'
                    							}, {
                    								id: 'AMCELLPHON',
                    								autoCreate: {
                    									tag: 'input',
                    									maxlength: '20'
                    								},
                    								fieldLabel: 'Cell Phone #'
                    							}, {
                    								id: 'AMEMAILADR',
                    								autoCreate: {
                    									tag: 'input',
                    									maxlength: '60'
                    								},
                    								fieldLabel: 'e-Mail Address'
                    							}, {
                    								xtype: 'combo',
                    								id: 'AINFLUENCR',
                    								fieldLabel: 'Primary Influencer',
                    								triggerAction: 'all',
                    								emptyText: 'Select Influencer...',
                    								editable: false,
                    								forceSelection: true,
                    								valueField: 'IMCODE',
                    								displayField: 'IMNAME',
                    								store: new Ext.data.JsonStore({
                    									url: 'vvcall.pgm',
                    									fields: ['IMCODE', 'IMNAME'],
                    									root: 'APINFLLA',
                    									autoLoad: false,
                    									baseParams: {
                    										action: 'getComboInfl',
                    										pgm: 'apgetcombo'
                    									}
                    								}),
                    								mode: 'remote'
                    							}, {
                    								id: 'ACCOMMENTS',
                    								xtype: 'textarea',
                    								fieldLabel: 'Comments',
                    								maxLength: 5000,
                    								maxLengthText: 'max 5000 characters',
                    								enableKeyEvents: true,
                    								listeners: {
                    									// imposes a max length on this textarea even if the value is pasted in.
                    									'keyup': function(){
                    										var value = this.getValue();
                    										if (value.length >= this.maxLength) {
                    											this.setValue(value.slice(0, value.length - (value.length - this.maxLength)));
                    											InputTip.html = 'The maximum text length is ' + this.maxLength + ' characters';
                    											InputTip.showBy(this.id, 'tl-bl');
                    											InputTip.HideTask.delay(2000);
                    											
                    										}
                    									}
                    								}
                    							}, {
                    								xtype: 'superboxselect',
                    								id: 'ACTIVITIES',
                    								fieldLabel: 'Activities',
                    								triggerAction: 'all',
                    								emptyText: 'Select Activities...',
                    								valueField: 'EMEVENT',
                    								displayField: 'EMNAME',
                    								store: new Ext.data.JsonStore({
                    									url: 'vvcall.pgm',
                    									fields: ['EMEVENT', 'EMNAME'],
                    									root: 'APEVNT',
                    									autoLoad: false,
                    									baseParams: {
                    										action: 'getComboActiveEvent',
                    										pgm: 'apgetcombo'
                    									}
                    								}),
                    								mode: 'remote'
                    							}]
                    						}]
                                        }
                                    });
                                    
                                    tabs.render(document.body);
                                    
                                    // viewport definition to ensure the entire viewing space of the browser is utilized
                                    //
                                    var vp = new Ext.Viewport({
                                        layout: 'fit',
                                        items: [tabs]
                                    });
                                    
                                    fnCheckAuthority();
                                });
                            </script>
                        </head>
                        <body>
                        </body>
                    </html>

                    Comment


                    • #11
                      [SOLVED] parent.showMessage

                      In the upcoming release of 3.1 on March 26 valence.js will have Valence.util.msg.

                      Comment

                      Working...
                      X