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

Javascript length

Ciupaz
Registered: Jan 29 2009
Posts: 75

Hi all,
I've setted this Javascript function in Exit event of my Numeric Field:

if (this.rawValue.length != 6)
{
xfa.host.messageBox("Dossier must be composed of 6 numbers", "Dossier Titoli error", 3);
this.validate.nullTest="error";
this.mandatory="error";
false;
}

but this message appears also when the user input exactly 6 numbers.

What's the problem in this function?

Thanks in advance.

Luigi

My Product Information:
LiveCycle Designer, Windows
cyprd
Registered: Oct 21 2008
Posts: 49
Ciupaz wrote:
Hi all,
I've setted this Javascript function in Exit event of my Numeric Field:

if (this.rawValue.length != 6)
{
xfa.host.messageBox("Dossier must be composed of 6 numbers", "Dossier Titoli error", 3);
this.validate.nullTest="error";
this.mandatory="error";
false;
}

but this message appears also when the user input exactly 6 numbers.

What's the problem in this function?

Thanks in advance.

Luigi
I may be wrong, but with numeric field, you are not able to find the length of item as it is not string. You should check on the interval of the integer from 99999 till 1000000 to get you 6 digits number.
As posted before in other question, check this http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=43665#p43665

Adobe LiveCycle ES 8.2.1 (JBoss & Win)

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
In FormCalc you can use the "Len()" function to get the length of a field's value.

// raw valuexfa.host.messageBox(Concat("rawValue: ", $.rawValue, " Length: ", Len($.rawValue) ) )// formatted valuexfa.host.messageBox(Concat("formattedValue: ", $.formattedValue, " Lenght: ", Len($.formattedValue) ) )

George Kaiser

triplecoho
Registered: Jul 24 2009
Posts: 1
thanks for the solution was having same problems..

[url=http://dossierdesurendettement.org/][color=#DEDFDF][u]commission de surendettement[/u][/color][/url][color=#DEDFDF] - commission de surendettement, vous pouvez demander un dossier de surendettement.[/color]
karoty
Registered: Aug 26 2009
Posts: 1
I may be wrong, but with numeric field, you are not able to find the length of item as it is not string.
[url=http://pretpersonnelenligne.org][color=#DEDFDF][u]demande taux pret personnel en ligne credit simulation[/u][/url][/color][color=#DEDFDF] Faire un pret immobilier en ligne avec un bon credit[/color][url=http://pretpersonnelenligne.org][color=#DEDFDF][u]demande taux pret personnel en ligne credit simulation[/u][/url][/color]
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
This is a LiveCycle Designer forum and FormCalc works differently then JavaScript. One of these differences in that FormCalc uses a function to get the length of a item and is not accessing the length property like JavaScript. So LiveCycle Designer can test for a numeric value and convert it to a string before obtaining the length property. One could even write a JavaScript function to obatin the lenght of any value, it would just need to create a string using the 'toString()' method before computing the length of the value.

George Kaiser