0

I have a cloudpage containing a Smart Capture form that submits to a data extension. I am using Smart Capture because a submission then instantly triggers a journey entry.

The idea is that a subscriber gets to the page via an email link. Clicking on the link passes through their SubscriberKey. I then do a lookup to see if that SubscriberKey exists in the smart capture DE or not.

If they have never submitted the form (ie: their SubscriberKey is NOT already in the smart capture DE), then I want the smart capture from to display.

If they have already submitted the form, then I want to hide the form and display an alternate message.

I was thinking of using some AMPScript logic like this:

%%[
     IF @result = 'eligible'
]%%
       <!-- SMART CAPTURE FORM -->
%%[ ELSE ]%%
        <!-- ALTERNATE MESSAGE -->
%%[ ENDIF ]%%

The issue I'm having is that when using the drag and drop editor with content blocks, the code view of the page doesn't show all the html for the form, etc. It instead only shows the basic "slot" divs. So I don't understand how to get the above to work.

Is this a feasible approach? Or is there another better way to show/hide content and/or content blocks on a page using AMPScript variables?

1 Answer 1

2

Drag in HTML or Free Form blocks into slots around your smart capture form and alternate content and enter your AMPScript business logic in these blocks, similar to this

enter image description here

2
  • Works perfectly, thanks
    – Ben
    Jul 3, 2020 at 2:12
  • related to this, I have been trying to do the same but in an email in content builder, where I have drag and drop content blocks in between the two HTML blocks that contain the IF statement. However, I get an "missing ENDIF" error. Do you know if this works the same? Happy to pose this as a whole new question if need be. Thanks
    – Ben
    Feb 16, 2021 at 3:19

You must log in to answer this question.

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