Naming Elements Dynamically

famruch

15-10-2015

Hi Guys,

Does anyone know if it is possible to name adaptive form elements dynamically? For example if I have a textbox and a radio button, is it possible to code this logic into the textbox or radio button

if radiobutton.value == 1, then textbox element name = first

Thanks guys,

Afam

Accepted Solutions (1)

Accepted Solutions (1)

Sakshi1

15-10-2015

This can be achieved by css, If you see the Adaptive Form created using 'survey' template, it has each question prefixed by an incremental number, if one question is hidden, the numbers readjust. Also this can be seen in Adaptive Form created using 'simple enrollment' template, each panel title is prefixed with a number, if a panel is hidden (its visibility expression computes to false) the prefixed number readjusts according to series. Following is the css code governing these behavior:

//survey styles.less snippet .panel { counter-reset:section; } .panel .guidefield .guideFieldLabel:before { counter-increment: section; content: counter(section) ". "; padding-right: 5px; font-size: 17px; }
// simple enrollment styles.less snippet .wizard-navigators { text-transform: uppercase; > li { border: none; outline: none; &:before { border-width: 0px; margin-right: 10px; content: counter(item); .rounded-corners(5px); padding: 3px 8px; color: #ffffff; font-size: @tabs-font-size; background-color: @wizard-tabs-font-color; } }

Answers (4)

Answers (4)

famruch

15-10-2015

Thanks Deepak

Basically I have a radio button which dynamically hides/displays entire sections of an adaptive form.

The issue is each section is number i.e. 1. section 1, 2. section 2, 3. section 3

I was hoping that when a section gets hidden, for instance 2. section 2, I can rename 3. section 3 as 2. section 2

Kind Regards,

Afam

famruch

15-10-2015

Hi Deepak,

Slightly different request. Do you know any good links you can recommend to me on how to pre populate AEM adaptive forms using data from a web service?

Thanks mate.

Afam