Expand my Community achievements bar.

SOLVED

add space to the end of textfield value

Avatar

Former Community Member

Hi,

  I have a requirement where I need to append 2 spaces to ta textfield at the end of field for certain conditions.

I used Concat() function and if I checked the length, it added the space successfully in the scripting. But in the output display, it is not considering the space to the text. I need this particularly because all my text fields are right alligned and if I have a space appended to the text at the end, I should able to see it in the form

for ex:

       I need     Martin     ( for the first text field)

                   Martin       ( with two spaces appended)

I need the output in the above way.

Can you please help me out.

Sample code I wrote on scripting:

var raw = $.rawValue

$.rawValue = Concat(raw, Space(2))

-----------------------------

If I check the length of field, I could see that length got increased by 2. But I cannot display in the output.

Thanks in advance,

k.c

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Instead of inserting white spaces script to change the right indent:

if (this.rawValue == "Martin")
{
    this.para.marginRight = "1.5mm";
}
else
{
    this.para.marginRight = "0mm";
}

This is Javascript, but I am sure it will run in FormCalc.

N.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Instead of inserting white spaces script to change the right indent:

if (this.rawValue == "Martin")
{
    this.para.marginRight = "1.5mm";
}
else
{
    this.para.marginRight = "0mm";
}

This is Javascript, but I am sure it will run in FormCalc.

N.

Avatar

Level 7

I might be oversimplifying this but would it work to just set the right margin in the layout tab? No point writing a script if you don't need it.

Avatar

Former Community Member

Hi,

Sorry for the delay in replying. Thanks for your valuable answer nail. It helped me to solve my problem.

and this is for the other reply,

we need to set the margin based on dynamic data. Hence, we need to set it on scripting only.

Regards,

k.c