Hi
Im trying create a event in javascript to calcule age with birthdate
![[BUG?] Calendar field don't fill when event onchange is trigger image 1](fig1.png)
I add a custom/javascript module in form with this code:
[pre]function calculateage()
{[br] var fecha=document.getElementById("fecha_de_nacimiento").value;[br] var justnow=document.getElementById("nowdate").value;[br] alert("birthdate: "+ fecha+ " Now: "+justnow);[br] [br]}[br][/pre][br]
The problem is when i try pick a date in "fecha_de_nacimiento" the event trigger but don't write nothing in field "fecha_de_nacimiento" and then i can't calculate age in function :/
![[BUG?] Calendar field don't fill when event onchange is trigger image 2](fig2.png)
![[BUG?] Calendar field don't fill when event onchange is trigger image 3](fig3.png)
Im doing something wrong?
Im trying create a event in javascript to calcule age with birthdate
![[BUG?] Calendar field don't fill when event onchange is trigger image 1](fig1.png)
I add a custom/javascript module in form with this code:
[pre]function calculateage()
{[br] var fecha=document.getElementById("fecha_de_nacimiento").value;[br] var justnow=document.getElementById("nowdate").value;[br] alert("birthdate: "+ fecha+ " Now: "+justnow);[br] [br]}[br][/pre][br]
The problem is when i try pick a date in "fecha_de_nacimiento" the event trigger but don't write nothing in field "fecha_de_nacimiento" and then i can't calculate age in function :/
![[BUG?] Calendar field don't fill when event onchange is trigger image 2](fig2.png)
![[BUG?] Calendar field don't fill when event onchange is trigger image 3](fig3.png)
Im doing something wrong?
without this event it works ?
You might need to apply an onchange event directly in JS to the hidden field that's under the calendar that actually holds the selected date.
without this event it works ?
Yes, the event work fine, the problem is the calendar, when i choose the date, first launch event onchange and later fill the field with the date.. (click on field - calendar poppup - choose date and click - event onchange launch - event onchange finish - calendar fill field with data) then i can't pass the value fill to the date, maybe can i pass the value calendar to event? how?
You might need to apply an onchange event directly in JS to the hidden
field that's under the calendar that actually holds the selected date.
I don't know what you want say (sorry my english is no very good)
the hidden field is date nowdate, this load on load document, can't fire onchange because no change
I try apply the onchange event in the field "Age" where show the results of event, and work fine, but no its a soluction, because you need write anything here to launch the event
The problem is the calendar i thik, if the field is writeen before event is launch then will work as expected, or maybe a way to capture the calendar data on onchange launch
Just try to call $("#nowdate").val("2020") in the code, does it set the field value ?
what? the problem is get the birthdate data (fecha_de_nacimiento) i havent any problem with nowdate
The real problem is that the event "on change" from javascript is trigered after the value of calendar is set in the field, then i can't get it in the event.
The real problem is that the event "on change" from javascript is trigered after the value of calendar is set in the field, then i can't get it in the event.
Could you please download v7 beta and try this ? it should work fine, and actually there is a "Set Value" action that you can use directly!
http://www.chronoengine.com/blog
http://www.chronoengine.com/blog
This topic is locked and no more replies can be posted.
