HTMLFormEntry use a custom attribute as the value instead of ID

Hello People,

We are using HTML form entry to design our forms. In one of the forms, we want to perform some calculations based on the concept selected. The concept has a Custom Attribute Ratings which we want to use for calculation. We want to know how to get this attribute in our javascript files.

By default, the generated HTML looks like below

<input type="checkbox" id="w12" name="w12" value="165965" autocomplete="new-password">

Where the value 165965 is the ID of answer concept. We want this to be a CustomAttributeValue instead of ID.

Please let us know.

CC: @dkayiwa @ssmusoke @rrameshbtech @sukreet @vasanth2019 @mksd @mksrom

1 Like

Hi @mddubey, do you want to fetch the ‘Ratings’ concept attribute from the concept ID within an HFE form?

1 Like

Yes, we want to use this in our JavaScript calculations.

You can fetch the Concept by its ID using the Velocity function fn.getConcept(String conceptId), and once you have it at hand get the wanted attribute. Have you tried that?

1 Like

Sure, we can give this a try. However, in the scenario we want to avoid fetch all the concept as JavaScript variables.

The scenario is, we have a few question concepts added to form. The answer concepts have a rating associated. We want to do some calculations based on the rating of answer selected for a particular questions.

If we try the above method, we will have to fetch all the answer concept with their ratings. This way we will loose flexibility of the adding new answers going forward.

Not sure, if this is possible or there is a different approach towards this?