hi,
Calendar field is very strange !! Impossible to take his value in javascript, why?
After change, I want extract the year and put it in another field text in javascript... How can i do that ?
Thanks
And one more, when bugs will be solve?
Hello healy,
code html :
<input name="fiche[dateAgrement]" value="2018-09-12" data-events="[]" data-firstday="0" data-startmode="day" data-type="date" data-dformat="DD/MM/YYYY" data-sformat="YYYY-MM-DD" data-mindate="" data-maxdate="" data-opendays="" data-openhours="" data-startcalendar="" data-endcalendar="" data-popuppos="top center" data-ampm="0" placeholder="" id="dateAgrement" type="text" data-calendar="1" class="">
code js :
dateAgrement = jQuery("input[type='hidden'][name='fiche[dateAgrement]']");
console.log("date " + dateAgrement.val());
produces in the console :
date undefined
Regards
it doesn't work with me :-(
but i try this
jQuery(document).ready( function() {
dateAgrement = jQuery("#dateAgrement");
console.log( "DATE: " + jQuery('input[type="hidden"][name="fiche[dateAgrement]"]').val() ); --> undefined
console.log( "id DATE: " + jQuery(dateAgrement).val() ); --> 2018-09-12
jQuery(dateAgrement).on('change', function(){ --> event is in console[event] for this but nothing in console after change it
console.log( "id DATE: " + jQuery(dateAgrement).val() );
});
});2018-09-12
<input id="dateAgrement" name="fiche[dateAgrement]" value="2018-09-12" data-events="[]" data-firstday="0" data-startmode="day" data-type="date" data-dformat="DD/MM/YYYY" data-sformat="YYYY-MM-DD" data-mindate="" data-maxdate="" data-opendays="" data-openhours="" data-startcalendar="" data-endcalendar="" data-popuppos="top center" data-ampm="0" placeholder="" id="dateAgrement" type="text" data-calendar="1" class="">
<input type="hidden" name="fiche[dateAgrement]" value="2018-09-11">
It won't get the value on document ready, that just means the DOM is built, none of the other CF code has happened yet.
And again using the id won't help you you need the code I gave you to get the value from the hidden input field that holds the value.
I see the CF code attached to the input
with i can populate the value of the input. that means js see and isolates the input and js attached the event but it seems like a non-propagation somewhere stop the effect.. Sorry for my english
Send me access details and I'll look
PM it to me I can't see that
After investigation it's as I suspected - you can't get the VALUE of the calendar field on jQuery(document).ready() because it hasn't been filled at that point. It gets filled by the CF/CC form initialisation functions. You should use {var:read_data#.model.datefield} instead in your JS code to do something with the value on document.ready().