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

Lifecycle form design to have multiple required fields

markgagne
Registered: Mar 6 2007
Posts: 7

Hi All, I created a form in Acrobat which had a radio button which if one value was selected it asked for value for another text field. If when this form was printed it checked to see if this the radio button was 1 and the text field was empty or null. If so it prompted the used for a value, if they still did not give a value it replaced the first page of the form with a template. This was a way to prevent printing the form without completeing the form correctly. I have since moved the form to Lifecycle designer and modified the code to perform the same steps except I have a text box which is invisible instead of the template. However I cannot get the conditions to work

Javascript on PrePrint

if (TextField1.rawValue= " " || TextField1.rawValue= null + RadioButtonList = 1)
xfa.host.messageBox("value is empty Print")
else
xfa.host.messageBox(" go ahead to print")

in The Java Debugger I see this

invalid assignment left-hand side
1:XFA:form1[0]:#subform[0]:Button1[0]:click

Any help would be appreciated

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
>in The Java Debugger I see this>invalid assignment left-hand side
>1:XFA:form1[0]:#subform[0]:Button1[0]:clickThis refers to the line:

if (TextField1.rawValue= " " || TextField1.rawValue= null + RadioButtonList = 1)

And the message is talking about an assignment or setting a variable to a provided value. I think you want to compare a variable to a provided value. In JavaScript "=" is the assignment or set operator and not one of the equality operator, which are '==' and '==='. You probably want to use the less strict '==' equality operator. Also you might have problems using the "+' or additive operator for the "&" logical AND operator. And since you are writing a compound logical statement it would also be advisable to group the conditions with parenthesis to make sure they are interpreted in the correct order.HTH

George Kaiser

markgagne
Registered: Mar 6 2007
Posts: 7
Hi, that helped, but now I get the same error message for all conditions

if (TextField1.rawValue== " " & RadioButtonList == "2")
xfa.host.messageBox("value is empty Print")
else
xfa.host.messageBox(" go ahead to print")

I cannot get the value "is empty " message if the radiobutton is 1 or 2 and if the textfield1 is empty or filled

Any ideas no how
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Have you checked the values of the data you are trying to process:

// show the values being processed
console.show(); // open the debugging console
console.clear(); // clear any messages
console.println("TestField1: TextField1.rawValue + " Length: " + TextField1.rawValue.length);
console.println("Radio Button value: " + RadioButtonList)
console.println("(TextField1.rawValue == " " & RadioButtonList == \"2\"): + (TextField1.rawValue == " " & RadioButtonList == "2")); // show logical value of statementif (TextField1.rawValue == " " & RadioButtonList == "2")
xfa.host.messageBox("value is empty Print")
else
xfa.host.messageBox(" go ahead to print")

George Kaiser