I am attempting to generate a series of fields using addField, which takes a predefined suffix (e.g. 't') and concatenates this with a full stop (or period '.') followed by a numeric value (e.g. 153) which has been entered in a text box by the user.
e.g.
If I try to concatenate the three elements separately then the addField variable is undefined - this is also the case if I try to concatenate 't.' with the number, even when the value of the number field is set to string.
If the value in the text box is entered as .153, then it works - however the value is seen as a decimal, and a leading zero is added to it, even if the value is toString. This means I get a fieldname of t0.153 when i want t.153. I tried using a script to remove leading zero's, but it seems when the concatenation takes place that the zero is added back on again.
As I write I don't have my full script to hand, but will post it when I can - grateful for any suggestions
"If toast always lands butter-side down, and cats always land on their feet, what happens if you strap toast on the back of a cat and drop it?"
- Steven Wright
e.g.
Code:
var box1 = this.addField(("t" + "." + numval), "text", 0, [0, 0, 50, 50]);
If I try to concatenate the three elements separately then the addField variable is undefined - this is also the case if I try to concatenate 't.' with the number, even when the value of the number field is set to string.
If the value in the text box is entered as .153, then it works - however the value is seen as a decimal, and a leading zero is added to it, even if the value is toString. This means I get a fieldname of t0.153 when i want t.153. I tried using a script to remove leading zero's, but it seems when the concatenation takes place that the zero is added back on again.
As I write I don't have my full script to hand, but will post it when I can - grateful for any suggestions
"If toast always lands butter-side down, and cats always land on their feet, what happens if you strap toast on the back of a cat and drop it?"
- Steven Wright