Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Invalid Date

Last post 08-01-2008 12:15 by danid12. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-04-2008 11:27

    Invalid Date

    Is there a way to cancel the formatting of an invalid date with the webdatechooser? When a user enters an invalid date, I would like to display a message rather than reformatting it for them. I have the InvalidDateEntered event handled on the client side, but there does not seem to be a way to cancel the formatting without modifying the script files the control uses.

     

    Thank you,

    Chad

     

    • Post Points: 20
  • 03-19-2008 18:29 In reply to

    Re: Invalid Date

    Hi Chad,

    It is correct default behavior of WebDateChooser to restore last good date in case of invalid date. To modify that you need to use internal objects. If you may look at implementation of ig_webdropdown.js then you may find members "date" and "editor.good". If you set them to nulls, then last "good" date will be disabled. Unfortunately in case of misbehavior there is no support for usage of internal variables.

    function WebDC_InvalidDateEntered(oDateChooser,oInvalidEventArgs,oEvent)
    {
      oDateChooser.date=
    null;
      oDateChooser.editor.good=
    null;
      //alert('invalid date');
      //oDateChooser.date = new Date(....);
    }

    Regards,
    Viktor
    Infragistics web team
    • Post Points: 20
  • 06-25-2008 4:59 In reply to

    • Tsgsouth
    • Not Ranked
    • Joined on 06-10-2008
    • Points 60

    Re: Invalid Date

    Hi, Am i missing something, this doesnt seem to work.

     

    I have a WebDateChooser on the page. I add the client side event:

    dteCtrl.ClientSideEvents.InvalidDateEntered = "InvalidDateEntered"

    My Javascript function is as follows:

    function InvalidDateEntered(oDateChooser,oDate,oEvent){

    oDateChooser.setValue(null);

    oDateChooser.setText(null);

    oDateChooser.date=null;

    oDateChooser.editor.good=null;

    alert("hello");

    }

    The Function is being called but the value of the field is still being set to the First good date. I am using v8.2. How can I disable this functionality of first good date?

    Regards

    Chris

    • Post Points: 20
  • 06-25-2008 13:31 In reply to

    Re: Invalid Date

    Hi Chris,

    I can not explain or reproduce that. If you process InvalidDateEntered, then to set null date, it is enough only 1 from the list of your statements.

    I tried exact your codes and also tried to comment lines in function InvalidDateEntered. For example keep only 1st line (or 2nd or 3rd+4th lines). All cases worked exactly the same and generated null date.

    Regards,
    Viktor
    Infragistics web team
    • Post Points: 20
  • 06-26-2008 12:04 In reply to

    • Tsgsouth
    • Not Ranked
    • Joined on 06-10-2008
    • Points 60

    Re: Invalid Date

    Maybe I have missed something is the controls config...??

    <form id="form1" runat="server">

     

    <igsch:WebDateChooser runat="server" ID="wdcTest" AllowNull="true">

    </igsch:WebDateChooser>

     

    </form>

    Imports System.Data

    Imports System.Data.SqlClient

    Imports System.Drawing

    Partial Class Test

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Not IsPostBack Then

    wdcTest.MinDate = New Date(2008, 1, 1)

    wdcTest.MaxDate = New Date(2008, 2, 1)

    wdcTest.ClientSideEvents.InvalidDateEntered = "InvalidDateEntered"

    End If

    End Sub

    End Class

     

    function InvalidDateEntered(oDateChooser,oDate,oEvent){

    oDateChooser.setValue(null);

    alert("Nulled");

    }

     

     

    Interestingly the alert is popup up and i see the value of the date chooser as null and then i click the ok button on the alert and its reset.

    Ideas?

     

    Thanks

    Chris

    • Post Points: 20
  • 07-31-2008 13:47 In reply to

    • danid12
    • Top 500 Contributor
    • Joined on 07-26-2008
    • Points 170

    Re: Invalid Date

    Chris, Chad, (or anyone else),  were you able to get this working?  I am having the same problem, except I am using ver 6.2.

    • Post Points: 5
  • 08-01-2008 12:15 In reply to

    • danid12
    • Top 500 Contributor
    • Joined on 07-26-2008
    • Points 170

    Re: Invalid Date

    I figured out the problem.  If there's a window.alert in the js function, it has to be done AFTER setting the WebDateChooser to null.  Otherwise, it won't set the value.

    • Post Points: 5
Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems