Validating date entered by user when using DateCalendarCellType

Posted by: joe0569 on 15 November 2022, 9:38 am EST

  • Posted 15 November 2022, 9:38 am EST

    I would like to be able to validate data within a cell that is set as DateCalendarCellType. First I want to say that i like the calendar pop-up and want to use that interface with the user without adding as mask editor. However, I would like to be able to ensure two types of validation:

    1 - that the user has either selected a date or entered one via keyboard in mm/dd/yyyy format.

    2 - that the date entered or selected was not greater than today’s date.

    I am able to select a max and min value for an integer cell type and it validates perfectly, however I would like similar functionality for the DateCalendarCellType.

    Do you have a code sample for how to achieve this? I have been looking through the forum and cannot find one.

    My celltype is coded as follows:

                    ****Dim dc As New 
                    FarPoint.Web.Spread.Extender.DateCalendarCellType()
                    dc.Animated = True
                    dc.DateFormat = "MM/dd/yyyy"
                    dc.EnableOnClient = True
                    dc.Validators.Add(cvValidateSpread)
                    sv.Columns(9).CellType = dc**
    

    **

  • Posted 16 November 2022, 3:33 am EST

    hi,

    For this, you may need to use the editStart event and validate the cell. Please refer to the following code snippet and let me know if you face any issues.

    <script>
      function stoppedSpreadEdit(event) {
          window.status = "Edit stopped " + event.cell.outerHTML;
    //value the event.cell here according to you custom logic
       }
    FpSpread1.addEventListener("EditStart", startSpreadEdit)
    </script>

    DOcs: https://www.grapecity.com/spreadnet/docs/v14/online-asp/CSSR-onEditStopped.html

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels