Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

scripting - cannot access textfield if its value is empty

Avatar

Avatar
Level 1
falcop76794581
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
falcop76794581
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
falcop76794581
Level 1

08-04-2020

I'd like to perform some operations on textfields' values.

I cannot do these if the value of these is empty.

To clarify, I have a textfields with binding pointing to xml data.

So in binding I have somthing like $.root.branch.element.

And xml like

<root><branch><element>value</element></branch></root>

If value is set and I perform script:

xfa.host.messageBox(xfa.resolveNode('page.table.row.TxtElement').rawValue);

I get the Message with the value.

If XML is set like this instead:

<root><branch><element></element></branch></root>

when I perform script:

xfa.host.messageBox(xfa.resolveNode('page.table.row.TxtElement').rawValue);

nothing happens. No message.

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

08-04-2020

You can add a check for null values, to make this work.

var oField = xfa.resolveNode('page.table.row.TxtElement');
if (oField.isNull) {
    xfa.host.messageBox("The field is empty");
} else {
    xfa.host.messageBox(oField.rawValue);
}

 

Answers (0)