I'm using Adobe LiveCycle 8.0. I just created my first form. There is a few fields I would like to make required. I already have the TAB order the way I need it to be. Here's what I need to happen: If a user starts filling out the form & does not fill in any information in the client ID field, & they hit the TAb key, I want some kind of error to pop up telling them the client ID field is required. Is this possible? Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
As Dallas Kuhn said:
if (this.rawValue == '' || this.rawValue == null){
xfa.host.messageBox("The client ID field is required.");
}
The script should be added on the Exit event for the client ID field.
Can you post the form and I'll have a look at it?
Views
Replies
Total Likes
You can put the following JavaScript code into the exit event of the Client ID field:
if (this.rawValue == '' || this.rawValue == null){
xfa.host.messageBox("The client ID field is required.");
}
Just make sure you have selected JavaScript from the Language drop down and not FormCalc. You can also set the field type as 'User Entered - Required' in the 'Value' tab of the 'Object' Palette and insert a message in the 'Empty Message' box. This will then validate on submitting the form and a red border will appear on that field.
Views
Replies
Total Likes
In JavaScrpt you can use the following:
this.mandatory = "error"
It should be noted that it is not possible to turn of mandatory fully when in a formguide (if you are planning on using one.) It leaves an asterisks character in the caption.
Views
Replies
Total Likes
I have the form set to use JavaScript not FormCalc but I can't find the place I need to be to add the JavaScript....I've looked everywhere in the properties..can you advise me where to add the code?
Views
Replies
Total Likes
Is the field always supposed to be compulsary?
Views
Replies
Total Likes
Under the hierarchy tab I thought I could right click the field & choose "Insert Script Object" but "Insert Script Object" is greyed out.
Views
Replies
Total Likes
As Dallas Kuhn said:
if (this.rawValue == '' || this.rawValue == null){
xfa.host.messageBox("The client ID field is required.");
}
The script should be added on the Exit event for the client ID field.
Can you post the form and I'll have a look at it?
Views
Replies
Total Likes
I think your Script Editor is minimized. You can view it by clicking and dragging down the little arrow above the 'Preview PDF' tab, or select Window > Script Editor (Ctrl+Shift+F5). Once that is visible you need to click on the required field and then choose 'exit' from the 'Show' dropdown on the top left hand side of the editor. Paste that code in there.
Views
Replies
Total Likes
Script objects are for reusable functions, not for simple scripts attached to fields.
Ctrl-Shift-F5 will open the script editor for you if it's closed. Once in the script editor you can select the event that you want to attach the script to.
Views
Replies
Total Likes
I would like to eliminate that obnoxious red border while still making certain fields mandatory before using a submit button. Possible?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies