Hi Andfae
It seems you are using additional inputs to submit searches to a
SQLFORM.grid search widget...
1. Do not wrap the new inputs inside a form, as you are adding them to an
existing search form.
2. Add something like this as the last line in your *datainizioSrch *
function
$("#w2p_keywords").closest('form').find(':submit').click();
Best regards, D
On Friday, 26 April 2019 12:35:09 UTC+1, andfae wrote:
>
> Hello I will give you the code....ok?
>
> <script>
> var srchI, srchF, srch;
>
> // funzione che consente di impostare la ricerca Dalla Data
> function datainizioSrch(){
> var dataDa =
> moment($('#datepickerI').datepicker("getDate")).format('YYYY-MM-DD');
> srchI ='evento.inizio >= ' + '"' + dataDa + '"';
> if (srchF != undefined) {
> srch = srchI + ' and ' + srchF;
> } else {
> srch = srchI;
> }
> // console.log(srch);
> $("#w2p_keywords").val(srch);
> }
> // funzione che consente di impostare la ricerca Alla Data
> function datafineSrch(){
> // aggiunge 1 giorno per includere anche l'ultimo giorno della
> data di ricerca dataA
> var dataA = moment($('#datepickerF').datepicker("getDate")).add(1,
> 'days').format('YYYY-MM-DD');
> srchF ='evento.fine <= ' + '"' + dataA + '"';
> if (srchI != undefined) {
> srch = srchI + ' and ' + srchF;
> } else {
> srch = srchF;
> }
> // console.log(srch);
> $("#w2p_keywords").val(srch);
> }
>
> $(document).ready(function(){
>
> // la funzione di ricerca standard della grid viene nascosta
> $("#w2p_keywords").prop("type", "hidden");
>
> // Inserire gli elementi della ricerca custom dopo la ricerca
> standard ("#w2p_keywords").
> // Questo consente di non farla vedere sulle pagine edit e view
> // inserire i campi di ricerca nell'ordine inverso con i quali
> appaiono nella pagina
> var inputStr = '<form class="form-inline"> <div
> class="form-group" style="padding-bottom:5px;">Dalla Data: <input
> type="text" id="datepickerI" class="datepicker" readonly="true"
> onchange="datainizioSrch()"></div> <div class="form-group"
> style="padding-bottom:5px;">Alla Data: <input type="text" id="datepickerF"
> class="datepicker" readonly="true" onchange="datafineSrch()"></div></form>';
> $(inputStr).insertAfter("#w2p_keywords");
>
> // definisco il datepicker
> $("#datepickerI").datepicker({
> dateFormat: "dd/mm/yy",
> autoSize: true,
> firstDay: 1,
> dayNamesMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
> monthNames: [ "Gennaio", "Febbraio", "Marzo", "Aprile",
> "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre",
> "Dicembre" ],
> });
> $("#datepickerF").datepicker({
> dateFormat: "dd/mm/yy",
> autoSize: true,
> firstDay: 1,
> dayNamesMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
> monthNames: [ "Gennaio", "Febbraio", "Marzo", "Aprile",
> "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre",
> "Dicembre" ],
> });
> });
> </script>
>
>
> Il ven 26 apr 2019, 12:31 Massimiliano <[email protected] <javascript:>>
> ha scritto:
>
>> Is difficult to understand how you intend to trigger the search without
>> some infos.
>> Anyway just to give you an hint:
>>
>> jQuery("#your_custom_widget").closest('form').trigger('submit');
>>
>> On Fri, Apr 26, 2019 at 12:22 PM Andrea Fae' <[email protected]
>> <javascript:>> wrote:
>>
>>> They are the standard buttons "Search" and "Reset". I'd like from
>>> javascript in the html view to execute "Search" by code.
>>> Thank you
>>>
>>> Il giorno venerdì 26 aprile 2019 00:05:39 UTC+2, João Matos ha scritto:
>>>>
>>>> You don't have the standard buttons, but have a search button created
>>>> by you?
>>>>
>>>>
>>>> quinta-feira, 25 de Abril de 2019 às 15:21:41 UTC+1, Andrea Fae'
>>>> escreveu:
>>>>>
>>>>> I create a custom search, so not standard field with "Search" and
>>>>> "reset" button standard. How to click the button "Search"
>>>>> programmatically?
>>>>> thank you
>>>>>
>>>> --
>>> 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 [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Massimiliano
>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/McFLFwcll88/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.