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

Check the value of field

bctflex
Registered: Aug 8 2008
Posts: 37

I have the code below on the click event of a button which updates a record with any changes. When the form opens, a new record is automatically added to the database. The button is labeled "submit" , but it really updates.

I am trying to make sure the copyPersonMail field (radio button) has data. When I click the submit(update) button, there is no feedback from the form if the field is empty. What am I doing wrong?

xfa.sourceSet.WrkComp.update()

if (copyPersonMail.rawValue =! null && copyPersonMail.rawValue.length >= 0)
endif

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);

bctflex
Registered: Aug 8 2008
Posts: 37
Okay, I am still trying to solve this issue. I have two radio buttons which are mutually exclusive (copyInPerson & copyByMail) are the names of the buttons. The name of the field is copyPersonMail. I am looking to have a message inform the user if neither of the buttons are selected after the update button is clicked. I have inserted this code in the validate event once the update button is clicked.if (not (copyPersonMail.isNull | copyPersonMail == ""))

I am receiving the following error: Script failed (language is formcalc; context is xfa[0].form[0].Form1[0].InjuryNotice[0].#area[1].copyPersonMail[0])
script=if (not (copyPersonMail.isNull | copyPersonMail == ""))
Error: syntax error near token ')' on line 1, column 55.

I would appreciate some assistance. Thanks
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Are you using JavaScript or FormCalc?

Are you getting any error messages?

What value and length are you getting for the "copyPersonMail' radio button?
var sMsg = Concat("value of copyPersonMail: ", RadioButtonList.copyPersonMail.rawValue)sMsg = Concat(sMsg, " length: ", RadioButtonList.copyPersonMail.length) xfa.host.messageBox(sMsg)

You may also want to review the syntas of an "if then else endif" staement.

George Kaiser

bctflex
Registered: Aug 8 2008
Posts: 37
I would like to use FormCalc. I am not adept at java script or formcalc. I am trying to learn.

I am not getting any errors when I click the update button on the form if the copyPersonMail field is null which is my main concern.

The values of the radio buttons for the field (copyPersonMail) are "copyInPerson=1" and "copyByMail=0". As I stated before, I would like the form to alert the user there are form fields which are required when the update button is clicked and the fields are null.

Thanks for responding gKaiseril
xrum
Registered: Feb 25 2009
Posts: 124
if do not know either FormCalc or javascript, i would recommend you go with Javascript, it is more robust and has many more capabilities.
bctflex
Registered: Aug 8 2008
Posts: 37
Kaiseril,

What do you mean when you say length?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Both FormCalc and JavaScript are "Object" orientated languages. A field is one type of oject and the field object has a number of properties. These properties are items like "value", and "length". "value" is the content value of the field, and length is the number of characters in the value.

George Kaiser

bctflex
Registered: Aug 8 2008
Posts: 37
Okay, these are two Radio buttons combined to make one filed "copyPersonMail". The values of the two mutually exclusive buttons are "copyInPerson="1" and "copyByMail="0". I do not see any length properties, so I would think it to be 1.

As I stated before, I would like the form to alert the user there are form fields which are required when the update button is clicked and the fields are null.