XDP JavaScript validate text field with leading zero value issue in FR | Community
Skip to main content
LucreciousDFF
New Participant
June 14, 2021
Solved

XDP JavaScript validate text field with leading zero value issue in FR

  • June 14, 2021
  • 2 replies
  • 975 views

I have encountered an issue with JavaScript and showing or hiding a text box.

 

All works as expected in EN but not in FR. The value received in EN is "$0" and the one in FR is "0 $".

 

I am beginning to suspect this may be a bug with a leading zero in a floating text field.

 

Why would it work in EN as per:

 

if (this.rawValue != "$0"){

    xfa.resolveNode("COC.Body.sfBeneLimit.txtBeneLimit").presence = "hidden";

    xfa.resolveNode("COC.Body.sfBeneLimit.txtBeneLimitClause").presence = "visible";

}

 

But not in FR as per, the value received is correct:

 

if (this.rawValue != "0 $"){

    xfa.resolveNode("COC.Body.sfBeneLimit.txtBeneLimit").presence = "hidden";

    xfa.resolveNode("COC.Body.sfBeneLimit.txtBeneLimitClause").presence = "visible";

}

 

Any suggestions on alternate coding to check for 1st character being a zero might work, please suggest the code.

 

Does anyone know if this is a known issue? Has anyone encountered this before? Is there a better solution which I can test?

 

Thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by LucreciousDFF

This solution worked for me:

 

form1.#subform[0].TextField1::initialize - (JavaScript, client)
var str = TextField1.rawValue.substr(0,1);

if (str > 0){

TextField.rawValue = "100";

}

2 replies

LucreciousDFF
LucreciousDFFAuthorAccepted solution
New Participant
June 15, 2021

This solution worked for me:

 

form1.#subform[0].TextField1::initialize - (JavaScript, client)
var str = TextField1.rawValue.substr(0,1);

if (str > 0){

TextField.rawValue = "100";

}

LucreciousDFF
New Participant
June 14, 2021

What I may require is a simple alternate solution; check the value on exit and if first character is a zero do something else do nothing.

 

Here is a sample of an alternate approach which may work, however, I did not code it properly:

 

form1.#subform[0].NumericField::initialize - (JavaScript, client)
var str = NumericField.substr(0,1);

if (str > 0){

TextField.rawValue = "100";

}

 

With JavaScript can someone write this out so it works?

 

Thank you in advance...

 

 

This worked:

 

form1.#subform[0].TextField1::initialize - (JavaScript, client)
var str = TextField1.rawValue.substr(0,1);

if (str > 0){

TextField.rawValue = "100";

}