Expand my Community achievements bar.

SOLVED

expressing index # as a letter

Avatar

Level 4

I have an automatically numbered text field:

var number = this.parent.index + 1

this.rawValue = "" + number;

I would like this to express as a, b, c, etc. instead of 1, 2, 3.  Is that possible?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You could use ;

this.rawValue = String.fromCharCode(97 + this.parent.index);

where 97 is the character code for "a" ... so you would get into trouble if your had more than 26 fields.

Bruce

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

You could use ;

this.rawValue = String.fromCharCode(97 + this.parent.index);

where 97 is the character code for "a" ... so you would get into trouble if your had more than 26 fields.

Bruce

Avatar

Level 4

Bruce - I have another problem now.

I have attached my form so you can take a look.  I used your code for a repeating subform (detail) in a repeating subform (topic). So, details a, b, c, etc are created in topic1. I have the minimum set to 3, but it renders 4 (a, b, c, and d). Then, when I create subsequent instances of topic and add instances of detail, another instance shows up in the initial instance of topic.

Wow, that sounds complicated. It will make sense if you look at the form.

****NEVER MIND - I figured this out. I had the code in the initialize event somehow.*****