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

Simple problems mean I must be missing fundamentals

RichLorn
Registered: May 19 2008
Posts: 46
Answered

I've been doing ok with livecycle forms on a basic level. But there are some simple things driving me bananas. I'm using FormCalc in my following single-page practice dynamicXML form examples:
 
On the Click event of a button:
if (textfield1=="") then
xfa.host.messageBox("This field is empty","This is an alert")
endif
Nothing happens when the button is clicked. Ditto if I use textfield1.rawValue
 
In this next example, I set up a single column 4 row table. For this application, the table must be Positioned rather than Flowed, so the user can see all available filled and unfilled rows. The intent is if a row is empty between two filled rows, the filled rows will "rise up" to occupy the empty row, as in row3 will fill row2, row4 will fill row3, etc., and any remaining empty rows will be grouped together as the last rows of the table.
So on the practice form Click event of a button:
for i=0 upto 2 do //to prevent table row overflow, I'll tackle after this works
if (table1.row[i]=="") then
table1.row[i]=table1.row[i+1]
table1.row[i+1]=table1.row[i+2]
endif
endfor
Again, nothing happens when the button is clicked. Using .rawValue doesn't work either.
 
No doubt some of you are smiling, as these things must be so staightforward, and I don't see it. I've searched every Adobe publication I have but cannot find anything directly addressing this.

My Product Information:
LiveCycle Designer, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Try comparing to null, as opposed to an empty string:

if (textfield1 == null) then
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You can also use the 'HasValue()' funciton to test to see if there is a non-null value in the form field.

if (HasValue(textfield1) == false) then
xfa.host.messageBox("This field is empty","This is an alert")
endif

George Kaiser

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Accepted Answer
I think that should be:

if (not HasValue(textfield1)) then


To the OP, note that HasValue will give false if the field includes just blank spaces.
RichLorn
Registered: May 19 2008
Posts: 46
Thanks to both of you. Thats a big help! :)

Can you give me any insight on the table row question?
RichLorn
Registered: May 19 2008
Posts: 46
I was having a senior moment. Your answers actually did answer both of my questions.