These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Alert User Required Field Empty

bctflex
Registered: Aug 8 2008
Posts: 37

Hello,

I have searched this site for an answer to my problem and I have found numerous similar solutions, but none of them are working for me. I need to alert the user with a message and highlight the fields which are empty when the submit button (which is really an update) is clicked. Here is the code I found. There is a function which accompany this code. Thank you

xfa.sourceSet.WrkComp.update()

// Database control button >> update the current record with any changes.
var okToSumbit = true;
for (var j = 0; j < this.numFields; j++)
{
var fieldname =
this.getNthFieldName(j);
var theField = this.getField(fieldname);
if (theField.type != 'text')
continue;
var valid = checkField( theField );
if (!valid)
{
okToSubmit = False
break;

xfa.host.messageBox("Your application has been submitted. Please print a copy for your records. There is no need to save the form. It has been saved to the database.THANK YOU!!", "Workers Comp Form Submitted", 3, 0);

George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
Are you using Acrobat or LiveCycle Designer ot create your form?

George
bctflex
Registered: Aug 8 2008
Posts: 37
George

I am using LiveCycle 8 to create the form.

Thanks
bctflex
Registered: Aug 8 2008
Posts: 37
Hello again,

Is there anyone whom can point me in the right direction with respect to alerting the user there are empty fileds or just a message to inform the user the data has not been saved to the database prior to printing or closing the form? I copied and pasted some code in the first post of this thread.

Thanks again
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
I would check the field usng the "HasValue()" function, to see if the form field has had data entered, or see if the value of the field is null or empty. You also might consider using FormCalc with LiveCycle Designer, as there are differences between Acrobat's JavaScript and LiveCycle Designer's JavaScript with the "this" object indentifier.

George Kaiser