Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Help needed to validate a text field

Avatar

Level 1

I'm using Acrobat X1 Pro and Live Cycle Designer ES4

I have a numeric text field to capture a blank or 14 digit number.

The display pattern is: null{}|num{zzzzzzzzzzzzzz}

The edit pattern is: null{}|num{zzzzzzzzzzzzzz}

The validation pattern is:

The data pattern id : null{}|num{zzzzzzzzzzzzzz}

I'm trying to make test that the user:

only enters numbers

enters nothing or a 14 digit number.

Display an error message and set focus back on the field for wrong entries.

This is the code:

topmostSubform.Page1.AU01::exit - (JavaScript, client)

// Test AU number format

var re = /^[0-9]{14}$/

//Allow blank space in field

if (event.value !="") {

  if (re.test(event.value) == false) {

    app.alert ({

       cTitle: "Incorrect AU Format",

       cMsg: "Enter a valid 14-digit AU number."

    });

     getField("AU01").setFocus);

  }

}   

I get the error message when I exit the field regardless of what is in the field. And the set focus does not seem to work.

I can program in VBA but find Javascript challenging. What good reference books can you recommend?

May thanks.

Brian Dunkin

0 Replies