Remove everything after first commas (,) from string

Avatar

Avatar
Level 1
Ninarni
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
Ninarni
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
Ninarni
Level 1

12-08-2018

I have textfield1 and textfield2, I want to reduce characters after commas in textfield2

example:

textfield1 =

This is mango, the color is green

in textfield2 =

this is mango

I want to use if with initialization / trigger "comma (,)"

If in php like this :

remove everything after first comma from string in php - Stack Overflow

How i write in adobe live cycle

please help if anyone understands in adobe live cycle

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

13-08-2018

I am not sure what you mean by "various kinds of long characters".  But for the example you have you could put the following line of JavaScript code in the calculate event of textfield2

textfield1.rawValue.split(",")[0]

This assumes that textfield2 and textfield1 are at the same level in the form structure as the textfield1 is a relative reference.

Avatar

Avatar
Level 1
Ninarni
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
Ninarni
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
Ninarni
Level 1

13-08-2018

I want to make it automatic with various kinds of long characters

When i write in textfield1 , so textfield2 automatic corection after comma will be remove

How do i write the code ? Do use ...If...Else ?

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

12-08-2018

Hi,

In JavaScript you could use "textfield2.rawValue = "This is mango, the color is green".split(",")[0]"

Which turns your string into an array split on the comma and then you take the first one.