Limiting search criteria

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Limiting search criteria

kimonostereo
Hi folks,

Is there a way to limit a search in Lasso?

Currently if a user does a search with nothing entered in the search  
field it returns data. I'd like to instead give an error message  
asking them to enter at least 2 characters for a search. I'm still  
fresh to Lasso so I'm finding my way around and I'm having problems  
coding this part. I'm sure this has been discussed before... I wish  
this was listing in a easy tutorial somewhere since it seems like a  
basic thing to do.

thanks for any help you can offer!
\\scott\\
------------
Take a break and read a web comic ~
nemu*nemu - smiles to go!
http://nemu-nemu.com /




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Limiting search criteria

shelane
I'm guessing you're using a standard inline, not a sql statement for your
search.

The easiest way is to add a -req tag before your search field in the inline

like:
inline: -database='mydb', -table='mytable', -search, -req, -cn,
'myfield'=(action_param: 'searchfield')....


On 1/2/08 3:10 PM, "Scott Yoshinaga" <[hidden email]> wrote:

> Hi folks,
>
> Is there a way to limit a search in Lasso?
>
> Currently if a user does a search with nothing entered in the search
> field it returns data. I'd like to instead give an error message
> asking them to enter at least 2 characters for a search. I'm still
> fresh to Lasso so I'm finding my way around and I'm having problems
> coding this part. I'm sure this has been discussed before... I wish
> this was listing in a easy tutorial somewhere since it seems like a
> basic thing to do.
>
> thanks for any help you can offer!
> \\scott\\
> ------------
> Take a break and read a web comic ~
> nemu*nemu - smiles to go!
> http://nemu-nemu.com /
>
>
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Limiting search criteria

kimonostereo
Thanks Shane,

I'm working with just one field that searches a dictionary to look up  
that field. I'll try this and see if it works for me. Also I'm using a  
Filemaker database FYI.

\\scott\\
------------
Take a break and read a web comic ~
nemu*nemu - smiles to go!
http://nemu-nemu.com /



On Jan 2, 2008, at 1:19 PM, Shelane Enos wrote:

> I'm guessing you're using a standard inline, not a sql statement for  
> your
> search.
>
> The easiest way is to add a -req tag before your search field in the  
> inline
>
> like:
> inline: -database='mydb', -table='mytable', -search, -req, -cn,
> 'myfield'=(action_param: 'searchfield')....
>
>
> On 1/2/08 3:10 PM, "Scott Yoshinaga" <[hidden email]> wrote:
>
>> Hi folks,
>>
>> Is there a way to limit a search in Lasso?
>>
>> Currently if a user does a search with nothing entered in the search
>> field it returns data. I'd like to instead give an error message
>> asking them to enter at least 2 characters for a search. I'm still
>> fresh to Lasso so I'm finding my way around and I'm having problems
>> coding this part. I'm sure this has been discussed before... I wish
>> this was listing in a easy tutorial somewhere since it seems like a
>> basic thing to do.
>>
>> thanks for any help you can offer!
>> \\scott\\
>> ------------
>> Take a break and read a web comic ~
>> nemu*nemu - smiles to go!
>> http://nemu-nemu.com /
>>
>>
>>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Limiting search criteria

stevepiercy
In reply to this post by kimonostereo
Validate user input before you send it to the inline.

var('myfield'   = action_param('myfield));
if($myfield->size < 2);
    'Search term must contain at least 2 characters.';
else;
    // do your inline search
/if;

By the way, this is a good example of why you should always validate user input.  Users will do unexpected or evil things, such as enter '' when searching or attempt to do SQL injection.  When you fail to validate user input, users can throw whatever they want at or into your database.

--steve


On Wednesday, January 2, 2008, [hidden email] (Scott Yoshinaga) pronounced:

>Hi folks,
>
>Is there a way to limit a search in Lasso?
>
>Currently if a user does a search with nothing entered in the search  
>field it returns data. I'd like to instead give an error message  
>asking them to enter at least 2 characters for a search. I'm still  
>fresh to Lasso so I'm finding my way around and I'm having problems  
>coding this part. I'm sure this has been discussed before... I wish  
>this was listing in a easy tutorial somewhere since it seems like a  
>basic thing to do.
>
>thanks for any help you can offer!
>\\scott\\
>------------
>Take a break and read a web comic ~
>nemu*nemu - smiles to go!
>http://nemu-nemu.com /
>
>
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Limiting search criteria

kimonostereo
Ah that makes sense to do.  Very good points!
This works just like I wanted it to!

I need to learn how to convert from bracket Lasso to LassoScript  
next... *sigh*

thanks!
\\scott\\

------------
Take a break and read a web comic ~
nemu*nemu - smiles to go!
http://nemu-nemu.com /



On Jan 2, 2008, at 1:40 PM, Steve Piercy - Web Site Builder wrote:

> Validate user input before you send it to the inline.
>
> var('myfield'   = action_param('myfield));
> if($myfield->size < 2);
>    'Search term must contain at least 2 characters.';
> else;
>    // do your inline search
> /if;
>
> By the way, this is a good example of why you should always validate  
> user input.  Users will do unexpected or evil things, such as enter  
> '' when searching or attempt to do SQL injection.  When you fail to  
> validate user input, users can throw whatever they want at or into  
> your database.
>
> --steve
>
>
> On Wednesday, January 2, 2008, [hidden email] (Scott Yoshinaga)  
> pronounced:
>
>> Hi folks,
>>
>> Is there a way to limit a search in Lasso?
>>
>> Currently if a user does a search with nothing entered in the search
>> field it returns data. I'd like to instead give an error message
>> asking them to enter at least 2 characters for a search. I'm still
>> fresh to Lasso so I'm finding my way around and I'm having problems
>> coding this part. I'm sure this has been discussed before... I wish
>> this was listing in a easy tutorial somewhere since it seems like a
>> basic thing to do.
>>
>> thanks for any help you can offer!
>> \\scott\\
>> ------------
>> Take a break and read a web comic ~
>> nemu*nemu - smiles to go!
>> http://nemu-nemu.com /
>>
>>
>>
>>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy               Web Site Builder               Soquel, CA
> <[hidden email]>                  <http://www.StevePiercy.com/>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Limiting search criteria

stevepiercy
That's easy.

['hello']

and

[
'hello';
]

are exactly the same thing.

People tend to get hung up on : v. () syntax because the documentation is written primarily to : syntax.  Personally I find : to be less intuitive and more ambiguous.  There is a recent TOTW that covers this topic.

[
var:'var1' = 'foo1',
    'var2' = 'foo2',
    'var3' = 'foo3';
]

and

[
var('var1' = 'foo1',
    'var2' = 'foo2',
    'var3' = 'foo3'
);
]

are exactly the same thing.  Basically any parameters you would throw after : would be placed into ().

--steve


On Wednesday, January 2, 2008, [hidden email] (Scott Yoshinaga) pronounced:

>Ah that makes sense to do.  Very good points!
>This works just like I wanted it to!
>
>I need to learn how to convert from bracket Lasso to LassoScript  
>next... *sigh*
>
>thanks!
>\\scott\\
>
>------------
>Take a break and read a web comic ~
>nemu*nemu - smiles to go!
>http://nemu-nemu.com /
>
>
>
>On Jan 2, 2008, at 1:40 PM, Steve Piercy - Web Site Builder wrote:
>
>> Validate user input before you send it to the inline.
>>
>> var('myfield'   = action_param('myfield));
>> if($myfield->size < 2);
>>    'Search term must contain at least 2 characters.';
>> else;
>>    // do your inline search
>> /if;
>>
>> By the way, this is a good example of why you should always validate  
>> user input.  Users will do unexpected or evil things, such as enter  
>> '' when searching or attempt to do SQL injection.  When you fail to  
>> validate user input, users can throw whatever they want at or into  
>> your database.
>>
>> --steve
>>
>>
>> On Wednesday, January 2, 2008, [hidden email] (Scott Yoshinaga)  
>> pronounced:
>>
>>> Hi folks,
>>>
>>> Is there a way to limit a search in Lasso?
>>>
>>> Currently if a user does a search with nothing entered in the search
>>> field it returns data. I'd like to instead give an error message
>>> asking them to enter at least 2 characters for a search. I'm still
>>> fresh to Lasso so I'm finding my way around and I'm having problems
>>> coding this part. I'm sure this has been discussed before... I wish
>>> this was listing in a easy tutorial somewhere since it seems like a
>>> basic thing to do.
>>>
>>> thanks for any help you can offer!
>>> \\scott\\
>>> ------------
>>> Take a break and read a web comic ~
>>> nemu*nemu - smiles to go!
>>> http://nemu-nemu.com /
>>>
>>>
>>>
>>>
>>
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> Steve Piercy               Web Site Builder               Soquel, CA
>> <[hidden email]>                  <http://www.StevePiercy.com/>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/