Hi Anthony,

Thanks for your suggestion, below script alert("heeheehee") only got 
triggered when i moved the cursor in the textbox, edited the date 
yyyy-mm-dd manually, then moved the cursor to another field. 

after I modified to .on("input"), alert("xxyyyzzzz") only got triggered 
when I again moved the cursor in the textbox, edited the date yyyy-mm-dd 
manually, but this time no need to wait till the cursor moved to another 
field. After alert("xxyyyzzzz"), alert("heeheehee") was triggered 
immediately with .change()

I wonder if i can use .on('changeDate') and like below

links 
http://stackoverflow.com/questions/22507671/bootstrap-datepicker-change-date-event-doesnt-fire-up-when-manually-editing-date

http://bootstrap-datepicker.readthedocs.io/en/latest/events.html

On Tuesday, April 25, 2017 at 10:12:11 PM UTC+8, Anthony wrote:
>
> Does it get triggered when the field loses focus? How about if you use 
> .on("input", ...) instead of .on("change", ...)?
>
> Anthony
>
> On Tuesday, April 25, 2017 at 6:01:12 AM UTC-4, Rudy wrote:
>>
>> Hi there,
>>
>> I tried to generate a CREATE FORM using below, then in my view, I added a 
>> script trying to change the renew_date when an user changes the start_date 
>> by using .change(function()). jQuery could detect the change if I manually 
>> modified the date in the textbook, but not when I chose a date from the 
>> calendar. I read online seeing others suggesting to use .on('changeDate', 
>> function()), but it's still not working, any pointer is much appreciated.
>>
>> I am very new to javascript, i read online about jQuery, but it seems 
>> what people suggest don't work in web2py environment eg. on('changeDate'), 
>> .datepicker(). Could anyone point me to any useful documentation / 
>> tutorials about "using jQuery in web2py"? I have read chapter 11 of web2py 
>> online book, can't find anything about changeDate, should we use 
>> changeDate? if so, where can I find the complete list of events and effects?
>>
>>
>> db.define_table('subscription',
>>                 Field('item', 'reference item',  writable=False, 
>> label='Item Id'),
>>                 Field('start_date', 'date', default=request.now),
>>                 Field('renew_date', 'date', 
>> default=request.now+six_month),
>>                 Field('service_details', 'text'))
>>
>> form = SQLFORM(db.subscription).process()
>>
>> <script>
>> jQuery(document).ready(function(){
>>     alert("hello hello");
>>     $('.datepicker').datepicker({
>>         format: "yyyy-mm-dd",
>>     }) 
>>     
>>     jQuery('#subscription_start_date').change(function(){
>>         alert("heeheehee")
>>         jQuery('#subscription_service_details__row').slideToggle();
>>     });
>>     jQuery('#subscription_start_date').on('changeDate', function(){
>>         alert("xxyyyzzzz")
>>         jQuery('#subscription_service_details__row').slideToggle();
>>     });
>> });
>> </script>
>>
>

-- 
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.

Reply via email to