PeopleVine

Using Conditional Logic with HAPI

With our HAPI language you can now include conditional logic on whether or not to display a data-pv section.  Simply add the following tag to the component section:

data-pv-conditional="{@variable@} = value}"

{@variable@} is the variable that's either passed in the parameters section or via the query string in the URL.  The value should be plain text or numbers without any quotes.

For example, notice how we display only the certain block that matches the {@sport@} parameter. 

<div data-pv-component="text">
  What sport do you like?
</div>
<div data-pv-component="text" data-pv-conditional="{@sport@} = baseball">
  Baseball
</div>
<div data-pv-component="text" data-pv-conditional="{@sport@} = basketball">
  Basketball
</div>
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.