Expand my Community achievements bar.

SOLVED

Reset a specific field

Avatar

Level 2

Hi

I want to reset only "passwordString" text field. But below code reset total form instead of resetting only "passwordString" field.

form1.page2.passwordHash::calculate - (JavaScript, client)

soHASHING_SHA256.hex_sha256(passwordString.rawValue)

form1.page2.passwordHash::mouseEnter - (JavaScript, client)

if(form1.page2.passwordHash.rawValue == null) {

form1.page2.passwordString.presence = "visible";

} else {

form1.page2.passwordString.presence = "hidden";}

form1.page2.passwordHash::mouseExit - (JavaScript, client)

var f1 = "xfa.form1.page2.passwordString";

xfa.host.resetData(f1);

Any help pls.

Regards

1 Accepted Solution

Avatar

Correct answer by
Level 7

You could just simply use - this.rawValue = null;

Wouldnt that do the same thing?

View solution in original post

4 Replies

Avatar

Level 4

When only resetting a single field or a limited number of fields on a form, I have always used the reset button, then altered the code to select on the field(s) I wanted removed. Note that I have always used the full address of the field and " " around the field name.

xfa.host.resetData("form1.#subform[0].TextField3");

Example can be found here:  Dropbox - Sample2.pdf

In this example, the click button only clears the entry in Textfield3, not all four fields.

Good luck.

Avatar

Level 10

Hi there,

the solution above is good. Also know that you can use the somExpression property of the field to specify its path.

Like the following :

for multiple fields use commas by concatenating somExpressions together...

Avatar

Correct answer by
Level 7

You could just simply use - this.rawValue = null;

Wouldnt that do the same thing?

Avatar

Level 2

Thanks to All of you who replied. But MinusZero's reply was very simple.