• rajasabhai rajasabhai
    December 14, 2017 at 5:24 am #4850

    How to check for a phrase on a string using scripts in events

     

    eg. I have a text box and I have to validate a particular text is not entered on the input. Can you provide me with how to look for in the onChange event?

    I should not allow Hello, if Hello is entered I will alert the user.

    Text : ” Hello! welcome world.”

    If above is user input I have to throw an alert to the user, as t contains <Hello>

     

    Thanks in advance.

    rajasabhai rajasabhai
    December 14, 2017 at 5:43 am #4851

    thanks all.. here is the solution i attempted

     

    me.getText().indexOf(“Hello”)> -1;

     

    to achieve the same. Thanks.

    SPARK Support
    December 14, 2017 at 10:21 am #4852

    Hi Rajasabhai,

    The Text control provides the context variables newText and oldText to the On Change event.

    You may wish to try using the On Input event with the context variables of current and potential.

    Please see our article on the Text control indicating which context variables are available to each event:

    https://support.salientprocess.com/docs/enterprise/Text.html

    As for the method to check for position of the first occurrence of a specified value in a string, please see the following article:

    https://www.w3schools.com/jsref/jsref_indexof.asp

    Regards,

    Stephen P.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search