Welcome Guest Search | Active Topics | Sign In | Register

isDirty on DatePicker Options
Patrick Beverloo
Posted: Wednesday, November 28, 2007 5:33:09 AM

Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 42
Hello,

I'm trying to add a Clientside is dirty on the datepicker after the date is changed, I need to set a Clientside var and change the background color of the textbox in the datepicker.

How do i set the background color on clientside using JavaScipt when the date is changed/slected?

Patrick Beverloo
OfficeSpecialisten www.OfficeSpecialisten.nl




eo_support
Posted: Wednesday, November 28, 2007 6:04:41 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Patrick,

The calendar itself won't do that for you. But I imagine you can do it with some minimum JavaScript trick. First you will need to find out the ID of the textbox control. The ID is not the same as the date picker's ID. You should be able to find that out by view page source. Once you have that you can just use JavaScript to change the style property to change the background color.

Thanks
Patrick Beverloo
Posted: Wednesday, November 28, 2007 6:11:41 AM

Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 42
How can i get the id from ClientSideOnSelect event

Code: HTML/ASPX
<eo:DatePicker ID="txtEmployedUntil" runat="server" DayCellHeight="16" DayCellWidth="19"
                                                            DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" PickerFormat="dd-MM-yyyy"
                                                            SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                                                            PopupExpandDirection="Bottom" "txtEmployedUntil" runat="server" DayCellHeight="16" DayCellWidth="19"
                                                            DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" PickerFormat="dd-MM-yyyy"
                                                            SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                                                            PopupExpandDirection="Bottom" ClientSideOnSelect="testevent" >
                                                        </eo:DatePicker>="testevent" >
                                                        </eo:DatePicker>


Code: JavaScript
function testevent(calendar, eventName){
                        if (eventName == 'Select'){
                            alert(calendar);
                            alert(calendar.ID);
                        }
                }


Patrick Beverloo
OfficeSpecialisten www.OfficeSpecialisten.nl




Patrick Beverloo
Posted: Wednesday, November 28, 2007 6:12:46 AM

Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 42
I have the code to change the color

Code: C#
if (!ClientScript.IsClientScriptBlockRegistered("DatePicker-onchange-function"))
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "DatePicker-onchange-function", "&lt;script language='JavaScript'&gt;" +
                                 "function DatePicker_checkForChange(obj) {\n" +
                                 "   var DPControl = document.getElementById('_eo_' + obj + '_picker'); \n" +
                                 "   alert(DPControl);\n" +
                                 "   isDirty = true;\n" +
                                 "   DPControl.style.backgroundColor='#6DC2FF';\n" +
                                 "   \n" +
                                 "}\n" +
                              "&lt;/script&gt;");
                    }


Patrick Beverloo
OfficeSpecialisten www.OfficeSpecialisten.nl




eo_support
Posted: Wednesday, November 28, 2007 6:13:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

You should use:

alert(calendar.getId());

Please check the help file for all the details.

Thanks
eo_support
Posted: Wednesday, November 28, 2007 6:17:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Patrick Beverloo wrote:
I have the code to change the color

Code: C#
if (!ClientScript.IsClientScriptBlockRegistered("DatePicker-onchange-function"))
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "DatePicker-onchange-function", "&lt;script language='JavaScript'&gt;" +
                                 "function DatePicker_checkForChange(obj) {\n" +
                                 "   var DPControl = document.getElementById('_eo_' + obj + '_picker'); \n" +
                                 "   alert(DPControl);\n" +
                                 "   isDirty = true;\n" +
                                 "   DPControl.style.backgroundColor='#6DC2FF';\n" +
                                 "   \n" +
                                 "}\n" +
                              "&lt;/script&gt;");
                    }


Cool! Thanks for sharing!
Patrick Beverloo
Posted: Wednesday, November 28, 2007 6:24:27 AM

Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 42
The code to change the background color,


Code: C#
if (!ClientScript.IsClientScriptBlockRegistered("DatePicker-onchange-function"))
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "DatePicker-onchange-function", "&lt;script language='JavaScript'&gt;" +
                                 "function DatePicker_checkForChange(calendar, eventName) {\n" +
                                 "   if (eventName == 'Select'){\n" +
                                 "      var objID = calendar.getId();\n" +
                                 "      \n" +
                                 "      var DPControl = document.getElementById('_eo_' + objID + '_picker'); \n" +
                                 "      isDirty = true;\n" +
                                 "      DPControl.style.backgroundColor='#6DC2FF';\n" +
                                 "   }\n" +
                                 "}\n" +
                              "&lt;/script&gt;");
                    }

                    EO.Web.DatePicker obj = c as EO.Web.DatePicker;
                    obj.ClientSideOnSelect = "DatePicker_checkForChange";


Patrick Beverloo
OfficeSpecialisten www.OfficeSpecialisten.nl






You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.