CA Service Management

 View Only
Expand all | Collapse all

Validation for Date Field in detail_in.htmpl

  • 1.  Validation for Date Field in detail_in.htmpl

    Posted Jun 19, 2015 10:25 AM

    I would like to know if there is a way to validate a date field in a call_req detail web form.

    This date must be typed by customers and then SDM must check if it's later than now (or alternatively, later than ticket's last update date).

    I found out that date control doesn't have an evt property, so I guess this validation couldn't be made through a javascript function.

  • 2.  Re: Validation for Date Field in detail_in.htmpl
    Best Answer

    Posted Jun 19, 2015 11:19 AM


    as I think date can be validated by js as well as by spel.


    js variant:

    add event to your date field, I prefer to use event listener.

    function attEvt(eventName, target, handlerName){
      if (target.addEventListener) {
      target.addEventListener(eventName, handlerName, false);
      } else if (target.attachEvent) {
      target.attachEvent("on" + eventName, handlerName);
      } else {
      target["on" + eventName] = handlerName;


    function z_validate(evt){
      if(string_to_date('',, '') < Math.round( / 1000)){
      alert("ERROR!"); = "";
    attEvt("blur", ahdframe.document.getElementsByName('SET.time_stamp')[0], z_validate);


    spel variant:

    mod file:

    MODIFY cr POST_VALIDATE z_check_date(z_my_date) 1337; // REPLACE z_my_date WITH YOUR DATE ATTR

    spl file:

      date znow, z_my_new_date;
      znow = now();
      z_my_new_date = argv[3];
      if((int)znow > (int)z_my_new_date ){
      logf(ERROR, "Your stdlog error here [%s]", ref_num);
      set_return_data(format("Your html error here [%s]", ref_num));

  • 3.  Re: Validation for Date Field in detail_in.htmpl

    Posted Jun 22, 2015 09:31 AM

    It's work ! Thanks.