How do I search a text field for a substring?

I need to search a user input, within a text field, for the value "V1". The user will input something like "V1 V2 V3 V4", The user can input it in any order. If the substring is not found, I will send an error message in the form of an alert box.

Brett Fleming

2 Answers

Voted Best Answer

There are different ways to do this. You would use a custom validation script (bring up the field properties, select the Validation tab and select a custom validation script). This could would check for the substring "V1":

var n = event.value.indexOf("V1");

if (n == -1) { // substring not found
    app.alert("Does not contain V1");
    event.rc = false;
else {
    event.rc = true;

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...

By Karl Heinz Kremer   

Works great thank you

Brett Fleming   

Please specify a reason: