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.

Question on validation

Avatar

Level 1

Hi Guys,

I have been trying out Adobe livecycle ES4 designer. I am wondering if it possible to reject the value that the user has input in a numeric/decimal field after it has fail a custom javascript validation. For example, the field has a boundary validation from 1 to 1000 and its original value of 10. The user changes the value of the field to 1111, the current behavior is such that there will be a  validation error message however the value 1111 is still "accepted", Is it  possible to revert the value to 10 once the new value fails the validation.  i have tried using xfa.event.prevText and xfa.event.newText, however at the validate event, both xfa.event.newText and xfa.event.prevText return empty,

5 Replies

Avatar

Level 8

How does your validation currently work? Validation pattern/script?

Kyle

Avatar

Level 1

Hi Kyle,

Thanks for the reply. It is a javascript method that return a boolean of the validation result.

Daniel

Avatar

Level 2

How about this?

if (this.rawValue > 1000) {

     this.rawValue = "10";

}

or a more abstract way: if a condition fails, update (or clear) the value of a field.

I usualy use prevText and newText with dropdowns.

Message was edited by: George Florentin

Avatar

Level 8

The best way to handle your situation is to store the value of your field in a variable when the user enters the field (ie before they change the value of the field).

For instance, say your variable is 'storeValue', you would put in the enter event of your field, storeValue.value=this.rawValue.

If your validation fails, you would script this.rawValue=storeValue.value;

There are other scripting methods for undoing events that are more complex but can go a long way. Here is one by John Brinkman: http://blogs.adobe.com/formfeed/Samples/scopeSample1.pdf

Kyle

Avatar

Level 1

Thanks. I managed to get what i wanted. I do have another question, is it possible to add a hyperlink on a image object in designer? i have tried out insert -> add hyperlink however it is only applicable to text. The rational for this is that i have a help icon on the pdf which the user is able to click and be directed to a webpage.