Home Search Member List Faq Register Login  
UltimateCalendar
set date to null with javascript

Thread Starter: geronimo1789   Started: 01-02-2012 10:37 AM   Replies: 5
 Karamasoft Support Forums » General Discussions » UltimateCalendar » set date to null with javascript
 Printable Version    « Previous Thread   Next Thread »
  02 Jan 2012, 10:37 AM
geronimo1789 is not online. Last active: 4/1/2012 10:19:32 AM geronimo1789

Top 10 Posts
Joined on 12-19-2008
Posts 54
set date to null with javascript

Hi sir,

How to set date to null or "" with Javascript ?

Thank you

This do not work :

document.getElementById("Date1").Text = '';
document.getElementById("Date1").value = '';

I have this :

 <cc1:ultimatedatepicker id="Datep1"   runat="server" 
      DateFormat="dd/MM/yyyy"
      style="z-index: 1; left: 126px; top: 333px; position: relative; width: 151px">
      <DatePickerTextBox  Font-Size="8pt" Font-Names="Verdana" Height="19px" Width="120px" 
 ID="Date1" Text="01-01-2012"> </DatePickerTextBox>
   <DatePickerImage ImageAlign="AbsMiddle" ID="UltimateDatePicker1_img"
style="cursorStick out tongueointer;position:relative;"></DatePickerImage>
</cc1:ultimatedatepicker>

 


  
  03 Jan 2012, 10:40 AM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: set date to null with javascript
If you are trying to clear the date picker textbox, use the GetDatePickerInputElem method as explained in the client-side API document at http://www.karamasoft.com/UltimateCalendar/ClientAPI.htm.

var datePickerInputElem = UltimateCalendars['UltimateCalendar1'].GetDatePickerInputElem();
datePickerInputElem.value = '';

Note that you need to replace 'UltimateCalendar1' with the client-side ID of your calendar control.

  
  06 Jan 2012, 8:08 AM
geronimo1789 is not online. Last active: 4/1/2012 10:19:32 AM geronimo1789

Top 10 Posts
Joined on 12-19-2008
Posts 54
Re: set date to null with javascript

Hi sir,

I have 2 dates on the web form, following the solution you said, it's only clear 1 date, how can I clear 2 dates on one instruction => the user click on a button REFRESH, then all the textbox he has wrote is cleared, and the 2 dates also. Your solution clear only the last date he has selected.

Thank you

 

 


  
  06 Jan 2012, 2:48 PM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: set date to null with javascript
You will either need to have an UltimateCalendar control per each UltimateDatePicker control and set the UltimateCalendarID of each UltimateDatePicker control accordingly or find the client-side ID of your date picker textboxes to clear their values on the client-side. With the second approach:

<input type="button" value="Clear" onclick="document.getElementById('<%=UltimateDatePicker1.DatePickerTextBox.ClientID%>').value = ''" />

You will need to change UltimateDatePicker1 in the above code with the ID of your own UltimateDatePicker control.

  
  07 Jan 2012, 4:21 AM
geronimo1789 is not online. Last active: 4/1/2012 10:19:32 AM geronimo1789

Top 10 Posts
Joined on 12-19-2008
Posts 54
Re: set date to null with javascript

Hi sir,

I will have a webform with 12 * 2 date ( 2 dates for one interval, and then 12 times).

Do you mean that I will have to put 24 calendars on my webform ???

Go back to the 2 dates I need now, How can I assign the second calendar to the second Datepicker ???

Here is the first datepicker

<cc1:ultimatedatepicker id="Datep1" runat="server"
DateFormat="dd/MM/yyyy"
style="z-index: 1; left: 126px; top: 333px; position: relative; width: 151px">
<DatePickerTextBox Font-Size="8pt" Font-Names="Verdana" Height="19px" Width="120px"
ID="Date1" Text="01-01-2012"> </DatePickerTextBox>
<DatePickerImage ImageAlign="AbsMiddle" ID="UltimateDatePicker1_img"
style="cursorStick out tongueointer;position:relative;"></DatePickerImage>
</cc1:ultimatedatepicker>

 

here is the second datepicker

<cc1:ultimatedatepicker id="Datep2" runat="server"
DateFormat="dd/MM/yyyy"
style="z-index: 1; left: 126px; top: 333px; position: relative; width: 151px">
<DatePickerTextBox Font-Size="8pt" Font-Names="Verdana" Height="19px" Width="120px"
ID="Date2" Text="01-01-2012"> </DatePickerTextBox>
<DatePickerImage ImageAlign="AbsMiddle" ID="UltimateDatePicker2_img"
style="cursorStick out tongueointer;position:relative;"></DatePickerImage>
</cc1:ultimatedatepicker>

Here is the calendar

<cc1:ultimatecalendar id="UltimateCalendar1" runat="server" PrevMonthText="<img border='0' src='LeftWhite.gif'>"

NextMonthText="<img border='0' src='RightWhite.gif'>"

DayNameFormat="FirstTwoLetters" Font-Names="Verdana" Font-Size="8pt" InitiallyHidden="True" AutoPostBackOnSelectionChanged="False">

<DayStyle BackColor="AliceBlue"></DayStyle>

<OtherMonthDayStyle ForeColor="Gray"></OtherMonthDayStyle>

<DayHeaderStyle BackColor="LightSkyBlue"></DayHeaderStyle>

<TitleStyle Wrap="False" ForeColor="White" BackColor="RoyalBlue"></TitleStyle>

<DayOverStyle BackColor="Orange"></DayOverStyle>

<MultiMonthTitleStyle Wrap="False"></MultiMonthTitleStyle>

<TodayDayStyle ForeColor="White" BackColor="RoyalBlue"></TodayDayStyle>

</cc1:ultimatecalendar>

 

Where is the link between the datepicker and the calendar ??

 

Thank you

 


  
  07 Jan 2012, 12:26 PM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: set date to null with javascript
If you have that many date picker controls in your page, use only one UltimateCalendar for performance reasons and use the following approach:

<input type="button" value="Clear" onclick="Clear()" />

<script type="text/javascript">
function Clear() {
   document.getElementById('<%=Datep1.DatePickerTextBox.ClientID%>').value = '';
   document.getElementById('<%=Datep2.DatePickerTextBox.ClientID%>').value = '';
   document.getElementById('<%=Datep3.DatePickerTextBox.ClientID%>').value = '';
   // and so on...
}
</script>

  
 Page 1 of 1 (6 items)
Karamasoft Support Forums » General Discussions » UltimateCalendar » set date to null with javascript

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.