BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  IBM BAW Plain Text Regular Expression

    Posted Fri January 20, 2023 04:20 AM
    Hello,

    I have a plain text field. In behaviour tab of plain text, there is regular expression. I wrote regular expression that accepts only 4 digit numbers. When I enter data which its length 5, error message is shown. Namely, regular expression is working. Error message is invalid format for content. Is there any way to change this error message?

    Please help me. Thanks for your concern.

    ------------------------------
    YASEMİN ALADI
    ------------------------------


  • 2.  RE: IBM BAW Plain Text Regular Expression

    Posted Fri January 20, 2023 06:05 AM
    Hello YASEMİN,

    You can alternatively write function to validate the field and call that from on blur event of the textbox.
    In the setValid() function of textbox you can set the error message as per your need.




    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 3.  RE: IBM BAW Plain Text Regular Expression

    Posted Fri January 20, 2023 06:28 AM
    Hi Atanu,

    Is it possible to send an example for function and onblur event content?

    Thanks for your help.

    ------------------------------
    YASEMİN ALADI
    ------------------------------



  • 4.  RE: IBM BAW Plain Text Regular Expression

    Posted Fri January 20, 2023 07:40 AM
    You need to write this function in the inline JS - 
    this.validateText = function(value){
    	var textView = this.ui.get("Text1");
    	var regExp = /^\d{4}$/;
    	if(value){
    		if(!regExp.test(value)){
    			textView.setValid(false, "Please enter 4 numbers");
    		}else{
    			textView.setValid(true);
    		}
    	}
    }​

    Then call it from the on blur event of the textbox, like - 
    view.validateText(me.getData());​

    Hope this helps.

    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------