I don't know much js, but where is the submit/save button/function?
sexta-feira, 26 de Abril de 2019 às 11:19:19 UTC+1, Andrea Fae' escreveu:
>
> Thank you for your answer, but I do not understand the code you wrote...
> the 2 fields are only filtering fields, no a db field.
>
> The filtering fields are working well, but I want that the dates selected
> will be preserved after postback. Do I have to read them from the
> querystring? In which way?
>
>
> This is my code
>
>
> var srchI, srchF, srch;
>
> // funzione che consente di impostare la ricerca Dalla Data
> function datainizioSrch(){
> var dataDa =
> moment($('#datepickerI').datepicker("getDate")).format('-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('-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 = '
';
> $(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" ],
> });
> });
>
> thank you
>
> Il giorno venerdì 26 aprile 2019 00:04:39 UTC+2, João Matos ha scritto:
>>
>> Is the selected date in a db field? Then when editing the same field, the
>> date picker should show the selected date.
>>
>> If the date is still not saved to a db field but only in js, then you can
>> send it using something similar to this
>>
>>
>>
>>
>>
>>
>>
>> quinta-feira, 25 de Abril de 2019 às 20:40:25 UTC+1, Andrea Fae' escreveu:
>>>
>>> How to preserve datepicker selected date after postback using web2py in
>>> a javascript view... I think it's a javascript problem but I don't know how
>>> to fix it.
>>> 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 y