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>