Naming Elements Dynamically | Community
Skip to main content
famruch
New Participant
October 16, 2015
Solved

Naming Elements Dynamically

  • October 16, 2015
  • 5 replies
  • 2428 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sakshi5

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; } }

5 replies

Employee
October 16, 2015

No, this is not supported.

What is the use case? May be I can help you with some alternate suggestion.

famruch
famruchAuthor
New Participant
October 16, 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

famruch
famruchAuthor
New Participant
October 16, 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

Sakshi5
Sakshi5Accepted solution
Employee
October 16, 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; } }
famruch
famruchAuthor
New Participant
October 16, 2015

Thanks Sakshi

Much appreciated.

Afam