CMS Development

dennisedson
HubSpot Product Team
HubSpot Product Team

How to get the value of a choice

SOLVE

Hello friends,

I am struggling to figure out how to print the value of a choice

 

on post page: 

{% choice "linkDirection" label='Choose the type of page', choices='Internal Link, External Link', export_to_template_context=True %}

on listing page:

{{ content.widgets.linkDirection.body.value }}

 

what is the correct code? 

 

Thanks in advance,

d

0 Upvotes
1 Accepted solution
dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

How to get the value of a choice

SOLVE

@tjoyce, actually my code was correct.  My browser must have cached a previous code iteration. 

as always, thanks for quick reply

 

{{content.widgets.linkDirection.body.value}}

View solution in original post

0 Upvotes
3 Replies 3
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to get the value of a choice

SOLVE

@dennisedson - 

{{widget_data.linkDirection.value}}

If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

0 Upvotes
dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

How to get the value of a choice

SOLVE

@tjoyce, actually my code was correct.  My browser must have cached a previous code iteration. 

as always, thanks for quick reply

 

{{content.widgets.linkDirection.body.value}}
0 Upvotes
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to get the value of a choice

SOLVE

@dennisedson - Or, since you don't have a default set with the value attribute, it may have just been an empty string.

0 Upvotes