Tuesday, December 12, 2017

AX - How validate ComboBox value (validate() method)

With validate() method you can define check(s) for control on form (return FALSE when is something wrong).
When combobox is bound to Enun, use this form:
public boolean validate()
{
  boolean ret;

  ret = super();

  /* do check */
    
  if ( JmgFeedbackStatus.selection() == JmgFeedbackStatus::Completed ) {
    ret = false;
    warning( "@SYS316081" );
    //throw Global::error( "The parameter value is invalid." );
  }    

  return ret;
}
When combobox is bound to DataSource, you can add validate() directly to datasource field:
public boolean validate()
{
  boolean ret;

  ret = super();

  /* do check */
    
  if ( JmgTmpJobBundleProdFeedback.ReportAsFinished == JmgFeedbackStatus::Completed ) {
    ret = false;
    warning( "@SYS316081" );
    //throw Global::error( "The parameter value is invalid." );
  }  

  return ret;
}

No comments:

Post a Comment