I just test, and it doesn't seem to make problem having line break...

The form didn't get parsed the way I thought... keywords is not empty in
case there is query parameters in the search field (name keywords) then
build_query() kicks in...

        if key and not ' ' in key and not '"' in key and not "'" in key:
            SEARCHABLE_TYPES = ('string', 'text', 'list:string')
            parts = [field.contains(
                key) for field in fields if field.type in SEARCHABLE_TYPES]

Not sure if the piece of code above is doing all the work or not...

Richard


On Thu, Apr 24, 2014 at 12:37 PM, Richard <ml.richard.vez...@gmail.com>wrote:

> Hello,
>
> I would improve default search widget a bit like that :
>
>                 if expert_search:
>                    search_widget = lambda sfield, url: CAT(FORM(
>                        TEXTAREA(_name='keywords',
>                                 _class='expert_search',
>                                 _value=request.vars.keywords,
>                                 _id=skeywords_id,
>                                 _onfocus=
> "jQuery('#%s').change();jQuery('#%s').slideDown();" % (spanel_id,sfields_id
> ) if advanced_search else ''
>                        ),
>                        INPUT(_type='submit', _value=T('Search'), _class="btn
> btn-default"),
>                        INPUT(_type='submit', _value=T('Clear'), _class="btn
> btn-default",
>                              _onclick="jQuery('#%s').val('');" %skeywords_id
> ),
>                        _method="GET", _action=url), search_menu)
>                else:
>                    search_widget = lambda sfield, url: CAT(FORM(
>                        INPUT(_name='keywords',
>                              _value=request.vars.keywords,
>                              _id=skeywords_id,
>                              _onfocus=
> "jQuery('#%s').change();jQuery('#%s').slideDown();" % (spanel_id,sfields_id
> ) if advanced_search else ''
>                        ),
>                        INPUT(_type='submit', _value=T('Search'), _class="btn
> btn-default"),
>                        INPUT(_type='submit', _value=T('Clear'), _class="btn
> btn-default",
>                              _onclick="jQuery('#%s').val('');" %skeywords_id
> ),
>                        _method="GET", _action=url), search_menu)
>
> So the search query is easier to write for an "expert"...
>
> But I didn't find where the search form get parsed... We need to strip
> line break of the textarea in order to have this feature.
>
> Thanks
>
> Richard
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to