Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Dynamically setting button caption from Data Source using JavaScript

Avatar

Level 2
Dear,



We use Interactive Forms in combination with SAP to generate forms in multiple languages. We usually do this using textfields and then linking all of those textfields to data we send from SAP. The data of these 'labels' is in a different language depending what you send through.



For buttons however we cannot simply link them in Binding so we decided to use Js to do it. There are already several checks in Js in place so I know the basics, but I can't figure out how to (a) retrieve data from the data sources and (b) how to set the button's caption using Javascript ...



Any ideas?



Thanks in advance,

Frederik-Jan Roose
3 Replies

Avatar

Former Community Member
Which data sources are you refering to?



To get access to a caption you will need:



Objectname.caption.value.text.value



The object assist will not have text in it (it will have #text). Simply use text in javascript and you will be OK.

Avatar

Level 2
Setting/Retrieving the button name works, thanks!



I'm still not sure on how to retrieve data however. With data I mean the fields that are available under the Data View palette. (bottom left corner, next to Hierarchy for me)

Avatar

Former Community Member
Depends on the type of connection ....are you making a web service call (getting back an xml structure) and want to use that or is the data connection to sample xml or a schema?