How to use user input as parameters

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

Hi,

I have a custom mashlet that opens a second mashlet passing parameters entered by the user in the initial mashlet but cannot get these parameters in the ema.load statement. I have tested the loading of the mashlet on its own and it works correctly aswell as entering the parameters manually within the "args" of the ema.load and this too works correctly.

The full script used is attached. The code below shows what is executed once the searchBtn has been clicked, I am trying to get the values of inputs "searchidbox" and "searchdatebox" into the args of "sID" and "ivDate" within Ema.load

Event.observe($('searchBtn'), 'click', function() {
       
            this.search1Txt = $('searchidbox').value;
            this.search2Txt = $('searchdatebox').value;
           
            Ema.load({
            serverUrl: "http://localhost:8080",
            el: "mtarget",
            name: "Insurance.Investigation.Mashlet",
            args: {
                sID: + this.search1Txt, ivDate: + this.search2Txt
            },
            callback: {
                onSuccess: function(mashlet){
                    console.log('mashlet loaded', mashlet);                 
                },
                onFailure: function(err){
                    console.log('Error loading mashlet', err);
                },
                scope: this
            }
        });   

0
Your rating: None
jeremy.pitten
jeremy.pitten's picture
User offline. Last seen 2 weeks 6 days ago. Offline
Joined: 09/22/2008
Points: 275

those plus signs in the args object literal are going to cause a problem. Try :

args: {
sID: this.search1Txt,
ivDate: this.search2Txt
},

 

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

thanks that was it