Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Two Granite text field is storing values comma separated

Avatar

Level 7

I have two text field in my dialog Text field 1, Path1 and Text Field 2, Path2 both TF have same name (./title) and both Path has same name (./path). I wanted if the author enters some value in TF1 and TF2. Value of TF2 should be stored, but it is storing values comma separated.

 

I want to overwrite the value and Want TF2 and Path2 value to be there

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Ronnie09 

the name field is a unique value to identify a field. Giving two fields the same name and making them both editable would make a weird issue. Ideally, it should have a different name.

 

However if a business requirement wants to have two fields, the best way is to make another field disabled and make one field enabled so that only one field can be filled at a time. Another field would fetch the same value.

Regards,

Arpit Varshney

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @Ronnie09 

the name field is a unique value to identify a field. Giving two fields the same name and making them both editable would make a weird issue. Ideally, it should have a different name.

 

However if a business requirement wants to have two fields, the best way is to make another field disabled and make one field enabled so that only one field can be filled at a time. Another field would fetch the same value.

Regards,

Arpit Varshney

Avatar

Community Advisor

@Ronnie09 Not really understanding the use case here, if you want both values to be stored with the same name, you could use a multifield which would have different items with the same name and you can iterate and use the last value of the multifield.