Link | web_request_params |
Author | Ke Carlton |
Category | Action |
Version | 9.x |
License | Public Domain |
Posted | 05 Aug 2015 |
Updated | 05 Aug 2015 |
More by this author... |
These methods allow you to work with web_request params in a more convenient and faster manner.
getparams // map containing all get params postparams // map containing all post params getparam('test') // value of all get params named test joined by break getparam('test',1) // value of first instance of get param named test getparam('test',2) // value of second instance of get param named test getparam('test',-count) // return the number of get param instances named test postparam('test') // value of all post params named test joined by break postparam('test',1) // value of first instance of post param named test postparam('test',2) // value of second instance of post param named test postparam('test',-count) // return the number of post param instances named test
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define getparams => { var(_getparams) ? return $_getparams return $_getparams := collateparams(web_request->queryparams) } define postparams => { var(_postparams) ? return $_postparams return $_postparams := collateparams(web_request->postparams) } define collateparams(params::trait_foreach) => { local(m = map,n,v,p) #params->foreach => { #p = #1 #n = #p->first if(#n) => { #v = #m->find(#n) #v->isa(::array) ? #v->insert(#p->second) | #v = array(#p->second) } #m->insert(#n = #v) } return #m } define getparam(name::string) => (getparams->find(#name) || staticarray)->join('\n') define postparam(name::string) => (postparams->find(#name) || staticarray)->join('\n') define getparam(name::string,i::integer) => protect => {return getparams->find(#name)->get(#i)} define postparam(name::string,i::integer) => protect => {return postparams->find(#name)->get(#i)} define getparam(name::string,-count) => (getparams->find(#name) || staticarray)->size define postparam(name::string,-count) => (postparams->find(#name) || staticarray)->size
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
-count added.