# Using the calendar date picker does not trigger the fields onchanged event

**URL:** <https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185>\
**Category:** Process Design\
**Created:** [October 12, 2018, 4:08am UTC](https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185 "2018-10-12T04:08:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcarruth](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@dcarruth](https://discuss.workflowgen.com/u/dcarruth)\
**Post date:** [October 12, 2018, 4:08am UTC](https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185/1 "2018-10-12T04:08:54Z")

</div>

I have a date field: LEAVE\_END\_DT  
When the date text is changed I want to set the value in another text field: LEAVE\_TOTAL\_DAYS

If I change the text in LEAVE\_END\_DT everything works fine. But if I use the calendar date picker then onchanged or ontextchanged events are not triggered.

---

<div class="post-metadata">

**Author:** ![qpomarel](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/qpomarel/32/262_2.png) [@qpomarel](https://discuss.workflowgen.com/u/qpomarel)\
**Post date:** [October 16, 2018, 12:03pm UTC](https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185/2 "2018-10-16T12:03:49Z")

</div>

Hi David,

You need to add an event on “date changed” event in the calendar. You can use the following code as an example.

```
protected void Page_Load(object sender, EventArgs e)
{
	base.Page_Load(sender, e);
	        
	if(!IsPostBack)
	{
		LEAVE_END_DT_CAL.AutoPostBack = true;
		LEAVE_END_DT_CAL.DateChanged += LEAVE_END_DT_CAL_DateChanged;
	}
}

protected void LEAVE_END_DT_CAL_DateChanged(object sender, EventArgs e)
{
	// Your code here
}

```

Regards,  
Quentin

---

<div class="post-metadata">

**Author:** ![dcarruth](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@dcarruth](https://discuss.workflowgen.com/u/dcarruth)\
**Post date:** [October 18, 2018, 11:55pm UTC](https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185/3 "2018-10-18T23:55:18Z")

</div>

Thanks Quentin,

I’ve put that code on the .net tab, and instead of // Your code here I have:  
LEAVE\_TOTAL\_DAYS.Text = “test”;

But when I use the calendar picker for LEAVE\_END\_DT it still doesn’t set LEAVE\_TOTAL\_DAYS to test.

Not sure what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [October 31, 2018, 3:44am UTC](https://discuss.workflowgen.com/t/using-the-calendar-date-picker-does-not-trigger-the-fields-onchanged-event/1185/4 "2018-10-31T03:44:32Z")

</div>

Hi David,

The event handler should be outside the `!IsPostBack` clause so that it executes when the postback occurs . Try this and let me know if it works:

```auto
protected void Page_Load(object sender, EventArgs e)
{
	base.Page_Load(sender, e);
	        
	if(!IsPostBack)
	{
		LEAVE_END_DT_CAL.AutoPostBack = true;
	}

        LEAVE_END_DT_CAL.DateChanged += LEAVE_END_DT_CAL_DateChanged;
}

protected void LEAVE_END_DT_CAL_DateChanged(object sender, EventArgs e)
{
	// Your code here
}

```
