User input to a custom mashlet

ermialfj
User offline. Last seen 2 years 3 weeks ago. Offline
Joined: 08/29/2009
Points: 30

I am a relative newbie at Presto and mashlets.  I am trying to create a custom mashlet modeled after MashletCom1 except that I want the mashlet to allow user input like mashlets created in wires.  I created the code below in the mashlet.json file,

 

 

"PeopleSearch": {

"type": "PeopleSearch",

"title":"This a test for PeopleSeardch",

"description": "",

"properties": {"FirstName": "Al*",

"LastName": "Smith"

},

"properties-meta": {

"FirstName": {

"type": "STRING",

"description": "First Name"

},

"LastName": {

"type": "STRING",

"description": "Last Name"

}

},

"resources": {

"libs": {

"presto_ext": "true"

},

"js": [{ "script": "main.js"}]

}

},

In the main.js file I have coded:

 

 

PeopleSearch = Class.create(Ema.BoxMashlet, {

function() {var FirstName = this.getPreference("FirstName");

var LastName = this.getPreference("LastName");

When I go to the mashlet maker and do CreateFromType, it builds the mashlet, but does not birng in the default values from the json file.  I can publish the mashlet, but at run time it does not give me the input parameters in the arguments where I could enter values for them.

How do I code a custom mashlet so that it allows user input?

 

0
Your rating: None
kishores
User offline. Last seen 38 weeks 1 day ago. Offline
Joined: 09/22/2008
Points: 81

Hi,

For custom mashlets like the one you are developing, you must include the Inputs in the Mashlet's markup. Please take a look at the samples - Sample.YUI.LocalSearch and Sample.YahooMap - that are provided as part of the Presto download. Look at <presto-install>/server/apache-tomcat-5.5.20/webapps/mashlet/Sample.YUI.LocalSearch/src.js and Sample.YahooMap/src.js.

Hope this helps.

Kishore