I have a checkbox in the page. It should be checked if the original value is True. I'm trying to implement ampscript for this, but it fails. Even it doeesn't show in the Preview.

I debugged, the value of @industry_news is displayed as true but the checkbox is not checked by default.

    <input name="industry-news" %%[ IF @industry_news == 'true' THEN ]%%checked%%[ ENDIF ]%% type="checkbox" value="Y" /> 
    Subscribe to Industry 

@industry_news is derived from the LookUpRows and set like below.

SET @industry_news = Field(@row,"Industry_News")

1 Answer 1


As mentioned in this post Using Ampscript to pre-fill form, check box ampscript is not working inside checkbox element when building the landing page with the "new" content builder interface via cloud pages.

The same code works when you build the Cloud page using Classic Editor--Code View option.

But if you still like to use the Content builder interface for your cloud page, you can dynamically set the checkbox checked property this way. This still works.

  %%[IF @industry_news == True THEN]%%
      <input name="industry-news" value="Y" type="checkbox" checked/> 
      <input name="industry-news" value="Y" type="checkbox" /> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .